Files
computer-playbook/roles/web-app-seaweedfs/tasks/01_init_consumer.yml
kevinveenbirkenbachandClaude Opus 5.5 6dde6458f5 refactor(web-app-seaweedfs): move the bucket task utils into a bucket/ folder
test_prefix_grouped_files rejects sibling files that share a delimiter-
bounded prefix: tasks/utils/bucket_list.yml and bucket_policy.yml become
tasks/utils/bucket/list.yml and policy.yml, and the includes follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:46:41 +01:00

35 lines
1.4 KiB
YAML

---
- name: "✅ Assert correct context"
ansible.builtin.assert:
that:
- application_id == 'web-app-seaweedfs'
- objstore_consumer_id != 'web-app-seaweedfs'
- name: "🔧 Provision the SeaweedFS bucket on the stack host"
when: IS_STACK_HOST | bool
vars:
_seaweedfs_bucket_listed: "{{ lookup('objstore', objstore_consumer_id, 'bucket') in (_seaweedfs_buckets.stdout | seaweedfs_bucket_names) }}"
block:
- name: "📋 List SeaweedFS buckets"
include_tasks: utils/bucket/list.yml
- name: "📁 Create the SeaweedFS bucket for '{{ objstore_consumer_id }}'"
ansible.builtin.shell: |
set -euo pipefail
echo 's3.bucket.create -name {{ lookup('objstore', objstore_consumer_id, 'bucket') }}' | container exec -i {{ SEAWEEDFS_CONTAINER_ADDRESS }} weed shell -master=localhost:{{ SEAWEEDFS_MASTER_PORT_INTERNAL }}
args:
executable: /bin/bash
register: _seaweedfs_create
changed_when: true
timeout: "{{ lookup('timeout', 60) | int }}"
retries: 3
delay: 10
until: _seaweedfs_create is succeeded
when: not _seaweedfs_bucket_listed
- name: "🔐 Converge the bucket policy of '{{ objstore_consumer_id }}'"
include_tasks: utils/bucket/policy.yml
vars:
seaweedfs_bucket_policy_consumer: "{{ objstore_consumer_id }}"
when: _seaweedfs_bucket_listed or _seaweedfs_create is changed