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

Split server install from configuration #58

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
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ minio_secret_key: ""

# Switches to enable/disable the Minio server and/or Minio client installation.
minio_install_server: true
minio_configure_server: true
minio_install_client: true
58 changes: 58 additions & 0 deletions tasks/configure-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
- name: Create Minio group
group:
name: "{{ minio_group }}"
state: present

- name: Create Minio user
user:
name: "{{ minio_user }}"
group: "{{ minio_group }}"
system: "yes"
shell: "/usr/sbin/nologin"

- name: Create the Minio data storage directories
file:
path: "{{ item }}"
state: directory
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
mode: 0750
when: minio_server_make_datadirs
with_items: "{{ minio_server_datadirs }}"

- name: Generate the Minio server envfile
template:
src: minio.env.j2
dest: "{{ minio_server_envfile }}"
owner: "root"
group: "{{ minio_group }}"
mode: 0640
notify: restart minio

- name: Create the Minio server systemd config
template:
src: minio.service.j2
dest: "/etc/systemd/system/minio.service"
owner: "root"
group: "root"
when: ansible_service_mgr == "systemd"
notify:
- reload minio systemd
- restart minio

- name: Create the Minio server init.d config
template:
src: minio.init.j2
dest: "/etc/init.d/minio"
owner: "root"
group: "root"
mode: 0750
when: ansible_service_mgr != "systemd"
notify: restart minio

- name: Enable and start the Minio service
service:
name: minio
state: started
enabled: true
57 changes: 0 additions & 57 deletions tasks/install-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,6 @@
set_fact:
_minio_server_checksum: "{{ lookup('url', _minio_server_download_url + '.sha256sum').split(' ')[0] }}"

- name: Create Minio group
group:
name: "{{ minio_group }}"
state: present

- name: Create Minio user
user:
name: "{{ minio_user }}"
group: "{{ minio_group }}"
system: "yes"
shell: "/usr/sbin/nologin"

- name: Create the Minio data storage directories
file:
path: "{{ item }}"
state: directory
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
mode: 0750
when: minio_server_make_datadirs
with_items: "{{ minio_server_datadirs }}"

- name: Download the Minio server
get_url:
url: "{{ _minio_server_download_url }}"
Expand All @@ -53,38 +31,3 @@
delay: 2
notify: restart minio

- name: Generate the Minio server envfile
template:
src: minio.env.j2
dest: "{{ minio_server_envfile }}"
owner: "root"
group: "{{ minio_group }}"
mode: 0640
notify: restart minio

- name: Create the Minio server systemd config
template:
src: minio.service.j2
dest: "/etc/systemd/system/minio.service"
owner: "root"
group: "root"
when: ansible_service_mgr == "systemd"
notify:
- reload minio systemd
- restart minio

- name: Create the Minio server init.d config
template:
src: minio.init.j2
dest: "/etc/init.d/minio"
owner: "root"
group: "root"
mode: 0750
when: ansible_service_mgr != "systemd"
notify: restart minio

- name: Enable and start the Minio service
service:
name: minio
state: started
enabled: true
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
- include_tasks: install-server.yml
when: minio_install_server

- include_tasks: configure-server.yml
when: minio_configure_server

- include_tasks: install-client.yml
when: minio_install_client