Skip to content

Commit

Permalink
update pg_hba tasks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vitabaks committed Apr 12, 2021
1 parent 1b5516e commit a7f683b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions roles/patroni/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@
owner: postgres
group: postgres
mode: 0640
register: generate_pg_hba
when: is_master == "true"

- name: Prepare PostgreSQL | generate pg_hba.conf on Replica
Expand All @@ -836,8 +837,9 @@
owner: postgres
group: postgres
mode: 0640
when: is_master != "true" and
postgresql_conf_dir != postgresql_data_dir
register: generate_pg_hba
when: (is_master != "true" and postgresql_conf_dir != postgresql_data_dir)
or postgresql_exists == "true"

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

Expand Down

0 comments on commit a7f683b

Please sign in to comment.