---
# include-gated: when: IS_COMPOSE_MODE
# Expected from caller (loop):
# - database_name
# - database_username
# - database_password
- name: "π§ Freeze database consumer id + provider role before provider include"
ansible.builtin.set_fact:
_matrix_db_consumer_id: "{{ application_id }}"
_matrix_db_provider_role: "{{ lookup('database', application_id, 'id') }}"
changed_when: false
- name: "π Create DB/user for '{{ database_name }}' in central DB"
include_role:
name: "{{ _matrix_db_provider_role }}"
public: false
vars:
database_init: true
compose_repository_pull: false
database_consumer_id: "{{ _matrix_db_consumer_id }}"
database_type: "{{ lookup('database', _matrix_db_consumer_id, 'type') }}"
when: lookup('database', _matrix_db_consumer_id, 'shared') | bool
- name: "π± Seed database entry to backup routine"
include_tasks: "{{ lookup('path_absolute', 'roles/svc-bkp-volume-2-local/tasks/03_seed-database-to-backup.yml') }}"
vars:
database_consumer_id: "{{ _matrix_db_consumer_id }}"
database_type: "{{ lookup('database', _matrix_db_consumer_id, 'type') }}"
database_instance: "{{ lookup('database', _matrix_db_consumer_id, 'instance') }}"
database_host: "{{ MATRIX_POSTGRES_HOST }}"
database_port: "{{ MATRIX_POSTGRES_PORT }}"
when:
- "'svc-bkp-volume-2-local' in group_names"
- IS_STACK_HOST | bool