Skip to content

Commit

Permalink
Split server install from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
scollazo committed Oct 2, 2023
1 parent 15ad3a3 commit 86e9c2b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 57 deletions.
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

0 comments on commit 86e9c2b

Please sign in to comment.