Skip to content

Commit

Permalink
Fix postgres check for RedHat (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
plirglo authored Jun 26, 2020
1 parent 7db368a commit e26d1ad
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@
var: snapshot_name

- name: Check if database is running on node0 database server
become: true
become_user: postgres
command: "pg_isready"
register: node0
ignore_errors: True
block:
- name: Check on Debian
become: true
become_user: postgres
command: "pg_isready"
register: node0
ignore_errors: True
when: ansible_os_family == 'Debian'

- name: Check on RedHat
become: true
become_user: postgres
command: "/usr/pgsql-10/bin/pg_isready"
register: node0
ignore_errors: True
when: ansible_os_family == 'RedHat'
when: groups['postgresql'][0] == inventory_hostname

- name: Debug
Expand Down Expand Up @@ -70,4 +81,4 @@
path: "/var/tmp/{{ snapshot_name }}/"
state: absent
when: (groups['postgresql'][0] == inventory_hostname and hostvars[groups['postgresql'][0]]['node0'].rc == 0) or
(groups['postgresql'][1] == inventory_hostname and hostvars[groups['postgresql'][0]]['node0'].rc != 0)
(groups['postgresql'][1] == inventory_hostname and hostvars[groups['postgresql'][0]]['node0'].rc != 0)

0 comments on commit e26d1ad

Please sign in to comment.