From 0f0d9afb6be01a6cfcb9595eac2b92126276e22e Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Sat, 9 Nov 2024 18:41:42 +0100 Subject: [PATCH] dd --- roles/mgrote_minio_configure/tasks/bucket.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/roles/mgrote_minio_configure/tasks/bucket.yml b/roles/mgrote_minio_configure/tasks/bucket.yml index 7c91e1b1..399dacdc 100644 --- a/roles/mgrote_minio_configure/tasks/bucket.yml +++ b/roles/mgrote_minio_configure/tasks/bucket.yml @@ -1,12 +1,13 @@ --- -- name: block bucket +- name: Block bucket creation with error handling block: - - name: setup minio buckets + - name: Setup MinIO buckets ansible.builtin.command: "{{ minio_client_bin }} --dp mb {{ minio_root_alias }}/{{ item.name }}" loop: "{{ minio_buckets }}" register: buckets rescue: - - name: print x + - name: Check if bucket already exists ansible.builtin.debug: - msg: "bucket exists already" - when: 'not "Your previous request to create the named bucket succeeded and you already own it." in buckets.stderr' + 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'