From 73a4e1d82432398b56c6d9a5847a604af534f415 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Sat, 9 Nov 2024 19:16:10 +0100 Subject: [PATCH] ff --- roles/mgrote_minio_configure/tasks/bucket.yml | 21 ++++++++----------- roles/mgrote_minio_configure/tasks/main.yml | 3 --- roles/mgrote_minio_configure/tasks/policy.yml | 1 + 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/roles/mgrote_minio_configure/tasks/bucket.yml b/roles/mgrote_minio_configure/tasks/bucket.yml index 399dacdc..54e3404e 100644 --- a/roles/mgrote_minio_configure/tasks/bucket.yml +++ b/roles/mgrote_minio_configure/tasks/bucket.yml @@ -1,13 +1,10 @@ --- -- name: Block bucket creation with error handling - block: - - name: Setup MinIO buckets - ansible.builtin.command: "{{ minio_client_bin }} --dp mb {{ minio_root_alias }}/{{ item.name }}" - loop: "{{ minio_buckets }}" - register: buckets - rescue: - - name: Check if bucket already exists - ansible.builtin.debug: - msg: "Bucket {{ item.item.name }} already exists." - loop: "{{ buckets.results }}" - when: '"Your previous request to create the named bucket succeeded and you already own it." in item.stderr' +- name: Add a Minio bucket + dubzland.minio.minio_bucket: + name: "{{ item.name }}" + auth: + access_key: "{{ minio_root_access_key }}" + secret_key: "{{ minio_root_secret_key }}" + url: "{{ minio_url }}" + state: present + loop: "{{ minio_buckets }}" diff --git a/roles/mgrote_minio_configure/tasks/main.yml b/roles/mgrote_minio_configure/tasks/main.yml index a38a5b2e..375ebc56 100644 --- a/roles/mgrote_minio_configure/tasks/main.yml +++ b/roles/mgrote_minio_configure/tasks/main.yml @@ -34,9 +34,6 @@ - name: include bucket tasks ansible.builtin.include_tasks: bucket.yml -- name: include policy tasks - ansible.builtin.include_tasks: policy.yml - - name: get all access keys (is set to true) ansible.builtin.command: "{{ minio_client_bin }} --dp admin accesskey list {{ minio_root_alias }} --all" when: minio_print_keys diff --git a/roles/mgrote_minio_configure/tasks/policy.yml b/roles/mgrote_minio_configure/tasks/policy.yml index 9add6702..09c7a6d9 100644 --- a/roles/mgrote_minio_configure/tasks/policy.yml +++ b/roles/mgrote_minio_configure/tasks/policy.yml @@ -1,4 +1,5 @@ --- +# https://galaxy.ansible.com/ui/repo/published/dubzland/minio/content/module/minio_policy/ ? - name: create needed dirs ansible.builtin.file: path: "{{ minio_config_dir }}"