xoxys.minio/tasks/setup.yml

74 lines
2.1 KiB
YAML
Raw Normal View History

2020-05-19 08:18:29 +00:00
---
- name: Prepare base folder
file:
path: "{{ minio_base_dir }}"
state: directory
owner: "{{ minio_user }}"
group: "{{ minio_user }}"
mode: 0750
become: True
become_user: root
- block:
2020-05-20 07:45:21 +00:00
- name: Prepare folder structure
file:
path: "{{ item }}"
2021-02-04 20:46:18 +00:00
mode: 0750
2020-05-20 07:45:21 +00:00
state: directory
loop: "{{ minio_data_dirs }}"
2020-05-19 08:18:29 +00:00
- name: Download Minio binary
get_url:
2020-05-20 07:45:21 +00:00
url: "{{ __minio_server_source }}{{ '/archive/minio.RELEASE.' + minio_server_version if minio_server_version != 'latest' else '/minio' }}"
dest: "{{ minio_base_dir }}/minio"
2020-05-19 08:18:29 +00:00
mode: 0750
notify: __minio_restart
2020-05-19 08:18:29 +00:00
become: True
become_user: "{{ minio_user }}"
2020-05-20 07:45:21 +00:00
2020-05-19 08:18:29 +00:00
- block:
2020-08-01 19:44:58 +00:00
- name: Download Minio client
get_url:
url: "{{ __minio_client_source }}{{ '/' + minio_client_version if minio_client_version != 'latest' else '/mc' }}"
dest: "/usr/local/bin/mc"
mode: 0755
- name: Create cronjobs
cron:
name: "{{ item.name }}"
minute: "{{ item.minute | default('*') }}"
hour: "{{ item.hour | default('*') }}"
day: "{{ item.day | default('*') }}"
month: "{{ item.month | default('*') }}"
weekday: "{{ item.weekday | default('*') }}"
job: "{{ item.job }}"
user: "{{ item.user | default(omit) }}"
cron_file: "{{ item.cron_file | default(omit) }}"
2020-08-01 20:01:16 +00:00
state: "{{ item.state | default('present') }}"
2020-08-01 19:44:58 +00:00
loop: "{{ minio_cronjobs }}"
loop_control:
label: "{{ item.name }}"
2020-05-19 08:18:29 +00:00
- name: Copy sysconfig file
template:
src: "etc/sysconfig/minio.j2"
dest: "{{ __minio_sysconfig }}"
mode: 0600
2020-05-19 08:18:29 +00:00
notify: __minio_restart
- name: Copy systemd unit file
template:
src: "etc/systemd/system/minio.service.j2"
dest: "/etc/systemd/system/minio.service"
2021-02-04 20:46:18 +00:00
mode: 0644
2020-05-19 08:18:29 +00:00
notify: __minio_restart
- name: Ensure minio service is up and running
service:
2020-05-19 08:18:29 +00:00
name: minio
daemon_reload: yes
enabled: yes
state: started
become: True
become_user: root