ansible-minio/tasks/install-server.yml

91 lines
2.4 KiB
YAML
Raw Normal View History

2018-08-20 20:25:15 +02:00
---
- name: Compose the Minio server download base url
set_fact:
_minio_server_download_base_url: "https://dl.minio.io/server/minio/release/linux-{{ go_arch }}"
- name: Compose the Minio server download url with lastest release
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/minio"
when: minio_server_release | length == 0
2018-08-20 20:25:15 +02:00
- name: "Compose the Minio server download url with release {{ minio_server_release }}"
2018-08-20 20:25:15 +02:00
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/archive/minio.{{ minio_server_release }}"
when: minio_server_release | length > 0
2018-08-20 20:25:15 +02:00
- name: "Get the Minio server checksum for {{ go_arch }} architecture"
2018-08-20 20:25:15 +02:00
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 }}"
2019-12-17 06:25:27 +01:00
system: "yes"
shell: "/usr/sbin/nologin"
2018-08-20 20:25:15 +02:00
- 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 }}"
dest: "{{ minio_server_bin }}"
owner: "root"
group: "root"
mode: 0755
checksum: "sha256:{{ _minio_server_checksum }}"
register: _download_server
until: _download_server is succeeded
retries: 5
delay: 2
notify: restart minio
2018-08-20 20:25:15 +02:00
- 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
2018-08-20 20:25:15 +02:00
- 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
2018-08-20 20:25:15 +02:00
- name: Enable and start the Minio service
service:
name: minio
state: started
enabled: true