homeserver/roles/mgrote_minio_configure/tasks/policy.yml

29 lines
923 B
YAML
Raw Normal View History

2024-11-09 10:34:23 +01:00
---
2024-11-09 19:16:10 +01:00
# https://galaxy.ansible.com/ui/repo/published/dubzland/minio/content/module/minio_policy/ ?
2024-11-09 19:19:10 +01:00
- name: create needed dirs
2024-11-09 10:34:23 +01:00
ansible.builtin.file:
path: "{{ minio_config_dir }}"
state: directory
owner: root
group: root
mode: '0644'
- name: create policy files
ansible.builtin.blockinfile:
path: "{{ minio_config_dir }}/{{ item.name }}"
block: "{{ item.policy }}"
state: present
2024-11-09 19:21:36 +01:00
create: true
2024-11-09 10:34:23 +01:00
loop: "{{ minio_policies }}"
- name: setup minio policies
ansible.builtin.command: "{{ minio_client_bin }} --dp admin policy create {{ item.name }} {{ minio_config_dir }}/{{ item.name }}"
loop: "{{ minio_policies }}"
2024-11-09 10:38:50 +01:00
- name: Assign MinIO policies to users
ansible.builtin.command: "{{ minio_client_bin }} --dp admin policy attach {{ item.1 }} --user {{ item.0.name }}"
loop: "{{ minio_users | subelements('policies') }}"
2024-11-09 19:19:10 +01:00
# ensure absent files are removed
# deletata to localhost