homeserver/friedhof/mgrote_minio_configure/tasks/policy.yml
Michael Grote e0f8219b8f
All checks were successful
ansible-lint / gitleaks (push) Successful in 6s
ansible-lint / Ansible Lint (push) Successful in 42s
remove minio (#252)
Reviewed-on: #252
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-11-25 18:52:01 +01:00

50 lines
1.8 KiB
YAML

---
# https://galaxy.ansible.com/ui/repo/published/dubzland/minio/content/module/minio_policy/ ?
- name: "ensure needed dirs exist"
ansible.builtin.file:
path: "{{ minio_config_dir }}"
state: directory
owner: root
group: root
mode: '0644'
delegate_to: localhost
- name: "prep: template policy files (ro)"
ansible.builtin.template:
dest: "{{ minio_config_dir }}/{{ item.name }}_ro"
src: policy_ro.j2
owner: root
group: root
mode: '0644'
loop: "{{ minio_buckets }}"
delegate_to: localhost
- name: "prep: template policy files (rw)"
ansible.builtin.template:
dest: "{{ minio_config_dir }}/{{ item.name }}_rw"
src: policy_rw.j2
owner: root
group: root
mode: '0644'
loop: "{{ minio_buckets }}"
delegate_to: localhost
- name: "setup policies (ro)"
ansible.builtin.command: "{{ minio_client_bin }} --disable-pager admin policy create {{ minio_root_alias }} {{ item.name }}_ro {{ minio_config_dir }}/{{ item.name }}_ro"
loop: "{{ minio_buckets }}"
changed_when: false # Befehl gibt immer "Created policy `testbucket3_ro` successfully." aus, unabhängig ob sie schon existiert oder nicht.
delegate_to: localhost
- name: "setup policies (rw)"
ansible.builtin.command: "{{ minio_client_bin }} --disable-pager admin policy create {{ minio_root_alias }} {{ item.name }}_rw {{ minio_config_dir }}/{{ item.name }}_rw"
loop: "{{ minio_buckets }}"
changed_when: false # Befehl gibt immer "Created policy `testbucket3_ro` successfully." aus, unabhängig ob sie schon existiert oder nicht.
delegate_to: localhost
- name: "remove old policy files"
ansible.builtin.file:
path: "{{ minio_config_dir }}/{{ item.name }}*"
state: absent
loop: "{{ minio_buckets }}"
when: '"absent" in item.state'
delegate_to: localhost