Skip to content

Commit 20d4290

Browse files
author
Alexander Maslov
committed
Add purge support
1 parent 15ad3a3 commit 20d4290

File tree

6 files changed

+97
-14
lines changed

6 files changed

+97
-14
lines changed

defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ minio_secret_key: ""
3939
# Switches to enable/disable the Minio server and/or Minio client installation.
4040
minio_install_server: true
4141
minio_install_client: true
42+
43+
# Purge minio
44+
minio_purge: "no"
45+
minio_purge_python_sni: "yes"
46+
minio_purge_data: "yes"

tasks/install-server.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
- name: Create the Minio server systemd config
6666
template:
6767
src: minio.service.j2
68-
dest: "/etc/systemd/system/minio.service"
68+
dest: "{{ minio_service_systemd_path }}"
6969
owner: "root"
7070
group: "root"
7171
when: ansible_service_mgr == "systemd"
@@ -76,7 +76,7 @@
7676
- name: Create the Minio server init.d config
7777
template:
7878
src: minio.init.j2
79-
dest: "/etc/init.d/minio"
79+
dest: "{{ minio_service_initd_path }}"
8080
owner: "root"
8181
group: "root"
8282
mode: 0750

tasks/main.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
---
22

3-
- name: Add sni support to legacy python installations
3+
- name: "purge minio"
4+
include_tasks: purge.yml
5+
when: minio_purge == "yes"
6+
7+
- name: "add sni support to legacy python installations"
48
include_tasks: python_sni.yml
59
when:
610
- ansible_os_family == 'Debian'
711
- ansible_python_version is version_compare('2.6.0', '>=')
812
- ansible_python_version is version_compare('2.7.9', '<')
13+
- minio_purge != "yes"
914

1015
- include_tasks: install-server.yml
11-
when: minio_install_server
16+
when:
17+
- minio_install_server
18+
- minio_purge != "yes"
1219

1320
- include_tasks: install-client.yml
14-
when: minio_install_client
21+
when:
22+
- minio_install_client
23+
- minio_purge != "yes"

tasks/purge.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
- name: "stop minio service"
3+
service:
4+
name: minio
5+
state: stopped
6+
enabled: false
7+
ignore_errors: true
8+
9+
- name: "remove minio systemd service"
10+
file:
11+
path: "{{ minio_service_systemd_path }}"
12+
state: "absent"
13+
when: ansible_service_mgr == "systemd"
14+
15+
- name: "remove minio init service"
16+
file:
17+
path: "{{ minio_service_initd_path }}"
18+
state: "absent"
19+
when: ansible_service_mgr != "systemd"
20+
21+
- name: "remove minio binary"
22+
file:
23+
path: "{{ item }}"
24+
state: "absent"
25+
with_items:
26+
- "{{ minio_server_bin }}"
27+
- "{{ minio_client_bin }}"
28+
29+
- name: "remove minio user"
30+
user:
31+
name: "{{ minio_user }}"
32+
state: "absent"
33+
34+
- name: "remove minio group"
35+
group:
36+
name: "{{ minio_group }}"
37+
state: "absent"
38+
39+
- name: "remove minio python sni support system packages"
40+
package:
41+
name: "{{ item }}"
42+
state: "absent"
43+
with_items: "{{ minio_python_sni_packages }}"
44+
when: minio_purge_python_sni == "yes"
45+
46+
- name: "remove minio python sni support pip packages"
47+
pip:
48+
name: "{{ item }}"
49+
state: "absent"
50+
with_items: "{{ minio_python_sni_pip_dependencies }}"
51+
ignore_errors: true
52+
when: minio_purge_python_sni == "yes"
53+
54+
- name: "remove minio data storage directories"
55+
file:
56+
path: "{{ item }}"
57+
state: "absent"
58+
with_items: "{{ minio_server_datadirs }}"
59+
when: minio_purge_data == "yes"

tasks/python_sni.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
- name: install python-pip and SNI support packages
44
package:
5-
name:
6-
- python-pip
7-
- python-dev
8-
- libssl-dev
9-
- libffi-dev
5+
name: {{ minio_python_sni_packages }}
106
state: present
117
register: _install_python_packages
128
until: _install_python_packages is succeeded
@@ -18,10 +14,7 @@
1814
# get_url module in server.yml and client.yml.
1915
- name: install the Python SNI python-pip dependencies.
2016
pip:
21-
name:
22-
- pyopenssl
23-
- ndg-httpsclient
24-
- pyasn1
17+
name: {{ minio_python_sni_pip_dependencies }}
2518
state: present
2619
register: _install_pip_packages
2720
until: _install_pip_packages is succeeded

vars/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,20 @@ go_arch_map:
77
armv6l: 'arm6vl'
88

99
go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
10+
11+
# Python SNI packages
12+
minio_python_sni_packages:
13+
- python-pip
14+
- python-dev
15+
- libssl-dev
16+
- libffi-dev
17+
18+
# There extra pip dependencies are needed to add SSL SNI support to
19+
# Python version prior to 2.7.9.
20+
minio_python_sni_pip_dependencies:
21+
- pyopenssl
22+
- ndg-httpsclient
23+
- pyasn1
24+
25+
minio_service_systemd_path: "/etc/systemd/system/minio.service"
26+
minio_service_initd_path: "/etc/init.d/minio"

0 commit comments

Comments
 (0)