Split server install from configuration

This commit is contained in:
Santiago Rodríguez 2023-10-02 10:47:35 +02:00
parent 15ad3a3604
commit 86e9c2b3f3
4 changed files with 62 additions and 57 deletions

View File

@ -38,4 +38,5 @@ minio_secret_key: ""
# Switches to enable/disable the Minio server and/or Minio client installation. # Switches to enable/disable the Minio server and/or Minio client installation.
minio_install_server: true minio_install_server: true
minio_configure_server: true
minio_install_client: true minio_install_client: true

View File

@ -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

View File

@ -17,28 +17,6 @@
set_fact: set_fact:
_minio_server_checksum: "{{ lookup('url', _minio_server_download_url + '.sha256sum').split(' ')[0] }}" _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 - name: Download the Minio server
get_url: get_url:
url: "{{ _minio_server_download_url }}" url: "{{ _minio_server_download_url }}"
@ -53,38 +31,3 @@
delay: 2 delay: 2
notify: restart minio 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

View File

@ -10,5 +10,8 @@
- include_tasks: install-server.yml - include_tasks: install-server.yml
when: minio_install_server when: minio_install_server
- include_tasks: configure-server.yml
when: minio_configure_server
- include_tasks: install-client.yml - include_tasks: install-client.yml
when: minio_install_client when: minio_install_client