36 lines
1.1 KiB
YAML
36 lines
1.1 KiB
YAML
---
|
|
# https://galaxy.ansible.com/ui/repo/published/dubzland/minio/content/module/minio_policy/ ?
|
|
- name: create needed dirs
|
|
ansible.builtin.file:
|
|
path: "{{ minio_config_dir }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: create needed files
|
|
ansible.builtin.file:
|
|
path: "{{ minio_config_dir }}/{{ item.name }}"
|
|
state: touch
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
loop: "{{ minio_policies }}"
|
|
|
|
- name: create policy files
|
|
ansible.builtin.blockinfile:
|
|
path: "{{ minio_config_dir }}/{{ item.name }}"
|
|
block: "{{ item.policy }}"
|
|
state: present
|
|
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 }}"
|
|
|
|
- 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') }}"
|
|
|
|
# ensure absent files are removed
|
|
# deletata to localhost
|