Files
computer-playbook/roles/web-app-bigbluebutton/tasks/02_administrator.yml
Kevin Veen-Birkenbach 9082443753 Refactor docker compose exec usage
Introduce centralized variables:
- docker_compose_command_base
- docker_compose_command_exec

Replaced hardcoded 'docker compose exec' with '{{ docker_compose_command_exec }}'
across multiple roles (BigBlueButton, EspoCRM, Friendica, Listmonk, Mailu, Matrix, OpenProject).
Ensures consistent environment file loading and reduces duplicated code.

Details: https://chatgpt.com/share/68d6a276-19d0-800f-839d-d191d97f7c41
2025-09-26 16:26:17 +02:00

31 lines
1.2 KiB
YAML

- name: "Wait until Greenlight is reachable via Nginx"
uri:
url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
validate_certs: true
status_code: 200
return_content: true
register: greenlight_http
until:
- greenlight_http.status == 200
- "'Greenlight' in greenlight_http.content or 'Sign in' in greenlight_http.content"
retries: 30
delay: 5
changed_when: false
- block:
- name: "Create default admin"
command:
cmd: >
{{ docker_compose_command_exec }} greenlight
bundle exec rake admin:create['{{ users.administrator.username | upper }}','{{ users.administrator.email }}','{{ users.administrator.password }}']
chdir: "{{ docker_compose.directories.instance }}"
register: admin_creation_result
# Treat exit codes 0 (created) and 2 (already exists) as success
failed_when: admin_creation_result.rc not in [0,2]
rescue:
- name: "Make existing user administrator"
command:
cmd: >
{{ docker_compose_command_exec }} greenlight
bundle exec rake user:set_admin_role['{{ users.administrator.email }}']
chdir: "{{ docker_compose.directories.instance }}"