homeserver/roles/mgrote.minio/tasks/main.yml
mg e2707856d8 service: minio (#232)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#232
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2021-10-23 17:47:57 +02:00

61 lines
1.4 KiB
YAML

---
- name: ensure group exists
ansible.builtin.group:
name: "{{ minio_group }}"
state: present
- name: ensure user exists
ansible.builtin.user:
name: "{{ minio_user }}"
group: "{{ minio_group }}"
shell: /sbin/nologin
state: present
- name: ensure needed directories are present
file:
path: "{{ item }}"
state: directory
owner: "{{ minio_user }}"
group: "{{ minio_user }}"
with_items:
- "{{ minio_volumes_base_dir }}"
- "{{ minio_config_dir }}"
- name: download binary
get_url:
url: "{{ minio_download_url }}"
dest: "{{ minio_bin_path }}/minio"
mode: 0744
owner: "{{ minio_user }}"
group: "{{ minio_user }}"
- name: template default config
become: yes
ansible.builtin.template:
src: "default.j2"
dest: "/etc/default/minio"
owner: "{{ minio_user }}"
group: "{{ minio_user }}"
notify: (re)start service
no_log: true
- name: template systemd-unit
become: yes
ansible.builtin.template:
src: "minio.service.j2"
dest: "/etc/systemd/system/minio.service"
mode: a+x
owner: "{{ minio_user }}"
group: "{{ minio_user }}"
notify: (re)start service
- name: systemd daemon reload
become: yes
ansible.builtin.systemd:
daemon_reload: true
- name: enable systemd service
become: yes
ansible.builtin.systemd:
name: minio
enabled: true