2020-12-13 20:40:32 +01:00
|
|
|
---
|
2020-12-13 21:56:56 +01:00
|
|
|
|
2020-12-13 20:40:32 +01:00
|
|
|
- name: Retrieve IP of postgres container
|
2020-12-13 21:45:48 +01:00
|
|
|
command: "{{ matrix_host_command_docker }} inspect matrix-postgres --format='{% raw %}{{ .NetworkSettings.Networks.{% endraw %}{{ matrix_docker_network }}{% raw %}.IPAddress }}{% endraw %}'"
|
2020-12-13 20:40:32 +01:00
|
|
|
register: matrix_postgres_container_ip
|
|
|
|
|
|
|
|
- name: Create additional users in postgres
|
|
|
|
postgresql_user:
|
2020-12-13 20:43:53 +01:00
|
|
|
name: "{{ item.username }}"
|
2020-12-13 20:40:32 +01: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 }}"
|
2020-12-13 21:56:56 +01:00
|
|
|
loop: "{{ matrix_postgres_additional_databases }}"
|
2020-12-13 20:40:32 +01:00
|
|
|
|
|
|
|
- name: Create additional users in postgres
|
|
|
|
postgresql_db:
|
|
|
|
name: "{{ item.name }}"
|
2020-12-13 20:43:53 +01:00
|
|
|
owner: "{{ item.username }}"
|
2020-12-13 20:40:32 +01: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 }}"
|
2020-12-13 21:56:56 +01:00
|
|
|
loop: "{{ matrix_postgres_additional_databases }}"
|