mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-06 10:47:32 +01:00
0641106370
We'll most likely use one that matches the database name, but it's better to have it configurable.
29 lines
1.0 KiB
YAML
29 lines
1.0 KiB
YAML
---
|
|
|
|
- name: Retrieve IP of postgres container
|
|
shell: "docker inspect matrix-postgres | jq -r '.[0].NetworkSettings.Networks.{{ matrix_docker_network }}.IPAddress'"
|
|
register: matrix_postgres_container_ip
|
|
|
|
- name: Create additional users in postgres
|
|
postgresql_user:
|
|
name: "{{ item.username }}"
|
|
password: "{{ item.pass }}"
|
|
login_host: "{{ matrix_postgres_container_ip.stdout }}"
|
|
login_port: 5432
|
|
login_user: "{{ matrix_postgres_connection_username }}"
|
|
login_password: "{{ matrix_postgres_connection_password }}"
|
|
login_db: "{{ matrix_postgres_db_name }}"
|
|
loop: matrix_postgres_additional_databases
|
|
|
|
- name: Create additional users in postgres
|
|
postgresql_db:
|
|
name: "{{ item.name }}"
|
|
owner: "{{ item.username }}"
|
|
lc_ctype: 'C'
|
|
lc_collate: 'C'
|
|
login_host: "{{ matrix_postgres_container_ip.stdout }}"
|
|
login_port: 5432
|
|
login_user: "{{ matrix_postgres_connection_username }}"
|
|
login_password: "{{ matrix_postgres_connection_password }}"
|
|
loop: matrix_postgres_additional_databases
|