Compare commits

..

1 Commits

View File

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