Compare commits
1 Commits
6fdc21291f
...
40d9c9bdd5
Author | SHA1 | Date | |
---|---|---|---|
40d9c9bdd5 |
@ -1,49 +1,49 @@
|
|||||||
---
|
---
|
||||||
- name: Configure postgresql
|
- name: Ensure postgresql superuser is set
|
||||||
block:
|
community.postgresql.postgresql_user:
|
||||||
- name: Ensure postgresql superuser is set
|
name: "{{ postgresql_admin_role }}"
|
||||||
community.postgresql.postgresql_user:
|
password: "{{ postgresql_superuser_password }}"
|
||||||
name: "{{ postgresql_admin_role }}"
|
login_host: >-2
|
||||||
password: "{{ postgresql_superuser_password }}"
|
|
||||||
login_host: "{{ postgresql_login_host }}"
|
|
||||||
register: postgresql_superuser_password_result
|
|
||||||
until: "postgresql_superuser_password_result is succeeded"
|
|
||||||
retries: 10
|
|
||||||
delay: 2
|
|
||||||
|
|
||||||
- name: Ensure postgresql configuration is set
|
|
||||||
community.postgresql.postgresql_set:
|
|
||||||
name: "{{ option.key }}"
|
|
||||||
value: "{{ option.value }}"
|
|
||||||
login_host: "{{ postgresql_login_host }}"
|
|
||||||
login_port: "{{ postgresql_config_port }}"
|
|
||||||
login_password: "{{ postgresql_superuser_password }}"
|
|
||||||
loop: "{{ postgresql_merged_options | dict2items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: option
|
|
||||||
|
|
||||||
- name: Ensure postgresql configuration is reloaded
|
|
||||||
community.postgresql.postgresql_query:
|
|
||||||
query: "SELECT pg_reload_conf();"
|
|
||||||
login_host: "{{ postgresql_login_host }}"
|
|
||||||
login_port: "{{ postgresql_config_port }}"
|
|
||||||
login_password: "{{ postgresql_superuser_password }}"
|
|
||||||
register: postgresql_config_results
|
|
||||||
|
|
||||||
- name: Ensure restart handler is fired if required
|
|
||||||
debug:
|
|
||||||
msg: "{{ result.option.key }} changed! Restart required: {{ result.restart_required }}"
|
|
||||||
when: result.changed
|
|
||||||
changed_when: "{{ result.restart_required }}"
|
|
||||||
notify: postgresql_restart
|
|
||||||
loop: "{{ postgresql_config_results.results }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: result
|
|
||||||
label: "{{ result.option.name }}"
|
|
||||||
vars:
|
|
||||||
postgresql_login_host: >-2
|
|
||||||
{{
|
{{
|
||||||
(postgresql_config_unix_socket_directories | first)
|
(postgresql_config_unix_socket_directories | first)
|
||||||
if postgresql_config_connect_socket else
|
if postgresql_config_connect_socket else
|
||||||
(postgresql_container_info.container.NetworkSettings.IPAddress)
|
(postgresql_container_info.container.NetworkSettings.IPAddress)
|
||||||
}}
|
}}
|
||||||
|
register: postgresql_superuser_password_result
|
||||||
|
until: "postgresql_superuser_password_result is succeeded"
|
||||||
|
retries: 10
|
||||||
|
delay: 2
|
||||||
|
|
||||||
|
- name: Ensure postgresql configuration is set
|
||||||
|
community.postgresql.postgresql_set:
|
||||||
|
name: "{{ option.key }}"
|
||||||
|
value: "{{ option.value }}"
|
||||||
|
login_host: >-2
|
||||||
|
{{
|
||||||
|
(postgresql_config_unix_socket_directories | first)
|
||||||
|
if postgresql_config_connect_socket else
|
||||||
|
(postgresql_container_info.container.NetworkSettings.IPAddress)
|
||||||
|
}}
|
||||||
|
login_port: "{{ postgresql_config_port }}"
|
||||||
|
login_password: #TODO
|
||||||
|
loop: "{{ postgresql_merged_options | dict2items }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: option
|
||||||
|
|
||||||
|
- name: Ensure postgresql configuration is reloaded
|
||||||
|
community.postgresql.postgresql_query:
|
||||||
|
query: "SELECT pg_reload_conf();"
|
||||||
|
login_host: #TODO
|
||||||
|
login_port: #TODO
|
||||||
|
login_password: #TODO
|
||||||
|
|
||||||
|
- name: Ensure restart handler is fired if required
|
||||||
|
debug:
|
||||||
|
msg: "{{ result.option.key }} changed! Restart required: {{ result.restart_required }}"
|
||||||
|
when: result.changed
|
||||||
|
changed_when: "{{ result.restart_required }}"
|
||||||
|
notify: postgresql_restart
|
||||||
|
loop: "{{ postgresql_config_results }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: result
|
||||||
|
label: "{{ result.option.name }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user