Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added purge support #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ minio_secret_key: ""
# Switches to enable/disable the Minio server and/or Minio client installation.
minio_install_server: true
minio_install_client: true

# Purge minio
minio_purge: "no"
minio_purge_python_sni: "yes"
minio_purge_data: "yes"
4 changes: 2 additions & 2 deletions tasks/install-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
- name: Create the Minio server systemd config
template:
src: minio.service.j2
dest: "/etc/systemd/system/minio.service"
dest: "{{ minio_service_systemd_path }}"
owner: "root"
group: "root"
when: ansible_service_mgr == "systemd"
Expand All @@ -76,7 +76,7 @@
- name: Create the Minio server init.d config
template:
src: minio.init.j2
dest: "/etc/init.d/minio"
dest: "{{ minio_service_initd_path }}"
owner: "root"
group: "root"
mode: 0750
Expand Down
15 changes: 12 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
---

- name: Add sni support to legacy python installations
- name: "purge minio"
include_tasks: purge.yml
when: minio_purge == "yes"

- name: "add sni support to legacy python installations"
include_tasks: python_sni.yml
when:
- ansible_os_family == 'Debian'
- ansible_python_version is version_compare('2.6.0', '>=')
- ansible_python_version is version_compare('2.7.9', '<')
- minio_purge != "yes"

- include_tasks: install-server.yml
when: minio_install_server
when:
- minio_install_server
- minio_purge != "yes"

- include_tasks: install-client.yml
when: minio_install_client
when:
- minio_install_client
- minio_purge != "yes"
59 changes: 59 additions & 0 deletions tasks/purge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
- name: "stop minio service"
service:
name: minio
state: stopped
enabled: false
ignore_errors: true

- name: "remove minio systemd service"
file:
path: "{{ minio_service_systemd_path }}"
state: "absent"
when: ansible_service_mgr == "systemd"

- name: "remove minio init service"
file:
path: "{{ minio_service_initd_path }}"
state: "absent"
when: ansible_service_mgr != "systemd"

- name: "remove minio binary"
file:
path: "{{ item }}"
state: "absent"
with_items:
- "{{ minio_server_bin }}"
- "{{ minio_client_bin }}"

- name: "remove minio user"
user:
name: "{{ minio_user }}"
state: "absent"

- name: "remove minio group"
group:
name: "{{ minio_group }}"
state: "absent"

- name: "remove minio python sni support system packages"
package:
name: "{{ item }}"
state: "absent"
with_items: "{{ minio_python_sni_packages }}"
when: minio_purge_python_sni == "yes"

- name: "remove minio python sni support pip packages"
pip:
name: "{{ item }}"
state: "absent"
with_items: "{{ minio_python_sni_pip_dependencies }}"
ignore_errors: true
when: minio_purge_python_sni == "yes"

- name: "remove minio data storage directories"
file:
path: "{{ item }}"
state: "absent"
with_items: "{{ minio_server_datadirs }}"
when: minio_purge_data == "yes"
11 changes: 2 additions & 9 deletions tasks/python_sni.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

- name: install python-pip and SNI support packages
package:
name:
- python-pip
- python-dev
- libssl-dev
- libffi-dev
name: "{{ minio_python_sni_packages }}"
state: present
register: _install_python_packages
until: _install_python_packages is succeeded
Expand All @@ -18,10 +14,7 @@
# get_url module in server.yml and client.yml.
- name: install the Python SNI python-pip dependencies.
pip:
name:
- pyopenssl
- ndg-httpsclient
- pyasn1
name: "{{ minio_python_sni_pip_dependencies }}"
state: present
register: _install_pip_packages
until: _install_pip_packages is succeeded
Expand Down
17 changes: 17 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,20 @@ go_arch_map:
armv6l: 'arm6vl'

go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"

# Python SNI packages
minio_python_sni_packages:
- python-pip
- python-dev
- libssl-dev
- libffi-dev

# There extra pip dependencies are needed to add SSL SNI support to
# Python version prior to 2.7.9.
minio_python_sni_pip_dependencies:
- pyopenssl
- ndg-httpsclient
- pyasn1

minio_service_systemd_path: "/etc/systemd/system/minio.service"
minio_service_initd_path: "/etc/init.d/minio"