30 lines
1 KiB
YAML
30 lines
1 KiB
YAML
---
|
|
# file: roles/minio/tasks/minio_buckets.yml
|
|
|
|
- name: "install ansible collection amazon.aws deps"
|
|
ansible.builtin.apt:
|
|
name:
|
|
- python3-botocore
|
|
- python3-boto3
|
|
# Needed to avoid : "[WARNING]: packaging.version Python module not installed, unable to check AWS SDK"
|
|
- python3-packaging
|
|
|
|
- name: "handle bucket {{ minio_bucket }}"
|
|
block:
|
|
- name: "check bucket {{ minio_bucket }}"
|
|
amazon.aws.s3_bucket_info:
|
|
name: "{{ minio_bucket }}"
|
|
endpoint_url: "http://localhost:{{ minio_port }}"
|
|
access_key: "minioadmin"
|
|
secret_key: "{{ minio_root_password }}"
|
|
register: check_bucket
|
|
failed_when: check_bucket.buckets | length == 0
|
|
rescue:
|
|
- name: "create bucket {{ minio_bucket }}"
|
|
amazon.aws.s3_bucket:
|
|
name: "{{ minio_bucket }}"
|
|
state: present
|
|
delete_public_access: true
|
|
endpoint_url: "http://localhost:{{ minio_port }}"
|
|
access_key: "minioadmin"
|
|
secret_key: "{{ minio_root_password }}"
|