xoxys.minio/tasks/setup.yml

58 lines
1.6 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
- name: Prepare folder structure
file:
path: "{{ item }}"
state: directory
loop: "{{ __minio_dirs + minio_data_dirs }}"
become: True
become_user: "{{ minio_user }}"
- block:
- name: Download Minio binary
get_url:
url: "https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.{{ minio_version }}"
dest: "{{ minio_bin_dir }}/minio.{{ minio_version }}"
mode: 0750
- name: Link Version {{ minio_version }} to latest
file:
src: "{{ minio_bin_dir }}/minio.{{ minio_version }}"
dest: "{{ minio_base_dir }}/minio-latest"
state: link
notify: __minio_restart
become: True
become_user: "{{ minio_user }}"
when: not minio_installed.stat.exists or ((minio_version | to_datetime('%Y-%m-%dT%H-%M-%SZ') - minio_current.stdout | to_datetime('%Y-%m-%dT%H-%M-%SZ')).total_seconds() / 3600) | int > 0
- block:
- name: Copy sysconfig file
template:
src: "etc/sysconfig/minio.j2"
dest: "{{ __minio_sysconfig }}"
notify: __minio_restart
- name: Copy systemd unit file
template:
src: "etc/systemd/system/minio.service.j2"
dest: "/etc/systemd/system/minio.service"
notify: __minio_restart
- name: Ensure minio service is up and running
systemd:
name: minio
daemon_reload: yes
enabled: yes
state: started
become: True
become_user: root