Skip to content
Snippets Groups Projects
Commit 7e1c5cf9 authored by Emmanuel Cohen's avatar Emmanuel Cohen
Browse files

double failover test using postgres-maintenance role, refs #33389

parent 9bafd7ac
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env ansible-playbook
---
- name: POSTGRESQL SWITCH CURRENT STANDBY TO PRIMARY
hosts: postgres_standby
tasks:
- name: fail if node status if not standby
fail:
msg: "Current status {{ rephacheck['stdout'] }} must be standby."
when: rephacheck['stdout'] != "standby"
- name: check if node is currently in standby
command: "repmgr standby switchover -f /etc/postgresql/11/main/repmgr.conf --siblings-follow --dry-run"
become: true
become_user: postgres
when: rephacheck['stdout'] == "standby"
register: standby_dry_run
- name: switch standby node to primary
command: "repmgr standby switchover -f /etc/postgresql/11/main/repmgr.conf --siblings-follow"
become: true
become_user: postgres
when:
- standby_dry_run is succeeded
- rephacheck['stdout'] == "standby"
...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment