2020-12-13 19:40:32 +00:00
|
|
|
---
|
|
|
|
- name: Retrieve IP of postgres container
|
2020-12-13 20:38:35 +00:00
|
|
|
shell: "{{ matrix_host_command_docker }} inspect matrix-postgres | jq -r '.[0].NetworkSettings.Networks.{{ matrix_docker_network }}.IPAddress'"
|
2020-12-13 19:40:32 +00:00
|
|
|
register: matrix_postgres_container_ip
|
|
|
|
|
|
|
|
- name: Create additional users in postgres
|
|
|
|
postgresql_user:
|
2020-12-13 19:43:53 +00:00
|
|
|
name: "{{ item.username }}"
|
2020-12-13 19:40:32 +00:00
|
|
|
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 }}"
|
2020-12-13 19:43:53 +00:00
|
|
|
owner: "{{ item.username }}"
|
2020-12-13 19:40:32 +00:00
|
|
|
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
|