changed Files: roles/mgrote_minio_configure/tasks/bucket.yml

roles/mgrote_minio_configure/tasks/main.yml
roles/mgrote_minio_configure/tasks/policy.yml

Signed-off-by: Michael Grote <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2024-11-24 20:58:33 +00:00
parent 61fc3f4afb
commit 20f1efc282
3 changed files with 11 additions and 0 deletions

View file

@ -8,9 +8,11 @@
url: "{{ minio_url }}"
state: "{{ item.state | default('present') }}"
loop: "{{ minio_buckets }}"
delegate_to: localhost
- name: Deletion Info
ansible.builtin.debug:
msg: "Deletion only possible with empty bucket ({{ item.name }})"
when: '"absent" in item.state'
loop: "{{ minio_buckets }}"
delegate_to: localhost

View file

@ -4,6 +4,7 @@
- name: include mcli tasks
ansible.builtin.include_tasks: client.yml
delegate_to: localhost
- name: ensure mc alias exists
dubzland.minio.minio_alias:
@ -12,6 +13,7 @@
access_key: "{{ minio_root_access_key }}"
secret_key: "{{ minio_root_secret_key }}"
state: present
delegate_to: localhost
- name: include policy tasks
ansible.builtin.include_tasks: policy.yml
@ -31,6 +33,7 @@
state: "{{ item.state | default('present') }}"
loop: "{{ minio_users }}"
no_log: "{{ no_debug | default('true') }}"
delegate_to: localhost
# Bug: delegate_to: localhost
# in ansible-devspace wird das Python Paket "minio" nicht gefunden

View file

@ -7,6 +7,7 @@
owner: root
group: root
mode: '0644'
delegate_to: localhost
- name: "prep: template policy files (ro)"
ansible.builtin.template:
@ -16,6 +17,7 @@
group: root
mode: '0644'
loop: "{{ minio_buckets }}"
delegate_to: localhost
- name: "prep: template policy files (rw)"
ansible.builtin.template:
@ -25,16 +27,19 @@
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:
@ -42,3 +47,4 @@
state: absent
loop: "{{ minio_buckets }}"
when: '"absent" in item.state'
delegate_to: localhost