minor update: only migrate HA VIP away when needed

When update tasks runs in a HA controller node, pacemaker is
stopped, along with all HA resources hosted on the node. If
any VIP is hosted on that node, it is moved to another node
prior to stopping pacemaker to limit service downtime.

If the HA controller node doesn't manage VIP (no HAProxy) or
the control plane only has 1 node, there is no need to try and
move VIP away before stopping pacemaker.

Tested on a 1-node HA control plane, and also on a control
plane with external balancer (no HAproxy service, thus no VIP
managed in pacemaker). The dedicated ansible task no longer
tries to move VIP if it doesn't need to.

Closes-Bug: #1892570
Change-Id: Id9b9c413ee37dcda422e69ebef4aca81e4877156
This commit is contained in:
Damien Ciabrini 2020-08-19 15:40:00 +02:00
parent ec33f9ce8f
commit 164fac75a0
1 changed files with 3 additions and 1 deletions

View File

@ -336,7 +336,9 @@ outputs:
async: 30
poll: 4
- name: Move virtual IPs to another node before stopping pacemaker
when: step|int == 1
when:
- step|int == 1
- hostvars[inventory_hostname]["haproxy_node_names"]|default([])|length > 1
shell: |
CLUSTER_NODE=$(crm_node -n)
echo "Retrieving all the VIPs which are hosted on this node"