Moving it above the "uninstalling" set of tasks is better. Extracting it out to another file at the same time, for readability, especially given that it will probably have to become more complex in the future (potentially installing `jq`, etc.)development
parent
dac0d3a682
commit
527d5f57d5
@ -0,0 +1,28 @@
|
||||
---
|
||||
|
||||
- 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.name }}"
|
||||
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.name }}"
|
||||
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
|
Loading…
Reference in new issue