Skip to content

Commit

Permalink
Check PostgreSQL is started
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Oct 2, 2024
1 parent a41ca81 commit c1769f4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions automation/roles/patroni/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,15 @@
{{ postgresql_bin_dir }}/pg_ctl start -D {{ postgresql_data_dir }} -o '-c hot_standby=off' -w -t {{ pg_ctl_timeout | default(3600) }}
when: is_master | bool or (not is_master | bool and 'pgbackrest' in patroni_create_replica_methods)

- name: Check PostgreSQL is started and accepting connections
ansible.builtin.command: "{{ postgresql_bin_dir }}/pg_isready -p {{ postgresql_port }}"
register: pg_isready_result
until: pg_isready_result.rc == 0
retries: 3
delay: 10
changed_when: false
when: is_master | bool or (not is_master | bool and 'pgbackrest' in patroni_create_replica_methods)

- name: Waiting for PostgreSQL Recovery to complete (WAL apply)
ansible.builtin.command: >-
{{ postgresql_bin_dir }}/psql -p {{ postgresql_port }} -U {{ patroni_superuser_username }} -d postgres -tAXc "select pg_is_in_recovery()"
Expand Down

0 comments on commit c1769f4

Please sign in to comment.