Skip to content

Commit a7f683b

Browse files
committed
update pg_hba tasks
Allow execution of the "generate pg_hba.conf on Replica" task for RedHat-based systems, if the "postgresql_exists" variable is "true". Allow to perform pg_hba tasks before executing the add_pgnode.yml playbook for cluster scaling: ansible-playbook deploy_pgcluster.yml --tags pg_hba
1 parent 1b5516e commit a7f683b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

roles/patroni/tasks/main.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@
827827
owner: postgres
828828
group: postgres
829829
mode: 0640
830+
register: generate_pg_hba
830831
when: is_master == "true"
831832

832833
- name: Prepare PostgreSQL | generate pg_hba.conf on Replica
@@ -836,8 +837,9 @@
836837
owner: postgres
837838
group: postgres
838839
mode: 0640
839-
when: is_master != "true" and
840-
postgresql_conf_dir != postgresql_data_dir
840+
register: generate_pg_hba
841+
when: (is_master != "true" and postgresql_conf_dir != postgresql_data_dir)
842+
or postgresql_exists == "true"
841843

842844
- name: Prepare PostgreSQL | reload for apply the pg_hba.conf
843845
become: true
@@ -846,6 +848,7 @@
846848
register: psql_reload_result
847849
changed_when: psql_reload_result.rc == 0
848850
failed_when: false # exec pg_reload_conf on all running postgres (to re-run with --tag pg_hba).
851+
when: generate_pg_hba is changed
849852
when: existing_pgcluster is not defined or not existing_pgcluster|bool
850853
tags: patroni, pg_hba, pg_hba_generate
851854

0 commit comments

Comments
 (0)