digitalboard.core/roles/send/tasks/main.yml
Simon Bärlocher bb64ccf71e
fix(send): assert S3 credentials when storage backend is s3
When send_storage_backend=s3 the role previously deployed the container
with whatever was in send_s3_* (often empty strings from the defaults).
The container would then start, accept uploads, and fail to persist
anything silently. Same pattern as the validate blocks in coturn,
talk, bookstack and opnform: fail fast at task time with a clear error
that points at the four missing variables.

Skipped entirely when send_storage_backend=local (the default).
2026-05-26 16:16:36 +02:00

42 lines
1.3 KiB
YAML

#SPDX-License-Identifier: MIT-0
---
# tasks file for send
- name: Assert S3 backend configuration when enabled
ansible.builtin.assert:
that:
- send_s3_endpoint | length > 0
- send_s3_bucket | length > 0
- send_s3_access_key | length > 0
- send_s3_secret_key | length > 0
fail_msg: >-
send_storage_backend is 's3' but one or more of send_s3_endpoint,
send_s3_bucket, send_s3_access_key, send_s3_secret_key is unset.
Provide via OpenBao, Ansible Vault or extra-vars — or switch
send_storage_backend to 'local'.
when: send_storage_backend == "s3"
- name: Create docker compose directory
ansible.builtin.file:
path: "{{ send_docker_compose_dir }}"
state: directory
mode: '0755'
- name: Create local upload directory
ansible.builtin.file:
path: "{{ send_docker_volume_dir }}/uploads"
state: directory
mode: '0755'
when: send_storage_backend == "local"
- name: Create docker-compose file for send
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ send_docker_compose_dir }}/docker-compose.yml"
mode: '0644'
notify: restart send
- name: Start send container
community.docker.docker_compose_v2:
project_src: "{{ send_docker_compose_dir }}"
state: present