2024-11-09 10:34:23 +01:00
|
|
|
---
|
2024-11-09 18:41:42 +01:00
|
|
|
- name: Block bucket creation with error handling
|
2024-11-09 18:38:37 +01:00
|
|
|
block:
|
2024-11-09 18:41:42 +01:00
|
|
|
- name: Setup MinIO buckets
|
2024-11-09 18:38:37 +01:00
|
|
|
ansible.builtin.command: "{{ minio_client_bin }} --dp mb {{ minio_root_alias }}/{{ item.name }}"
|
|
|
|
loop: "{{ minio_buckets }}"
|
|
|
|
register: buckets
|
|
|
|
rescue:
|
2024-11-09 18:41:42 +01:00
|
|
|
- name: Check if bucket already exists
|
2024-11-09 18:38:37 +01:00
|
|
|
ansible.builtin.debug:
|
2024-11-09 18:41:42 +01:00
|
|
|
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'
|