Issue
VRRP master script does not execute after reboot following initial VRRP configuration.
Steps to Re-Create
- Configure VRRP as below
- On the machine designated as MASTER - run restart vrrp
- On the machine now designated as MASTER - run show log vrrp to confirm script executed with "Running the command: <script name>"
- Repeat as many times to verify as needed
- Reboot current MASTER
- On the new MASTER run restart vrrp
- Go to the new MASTER (this was the machine just rebooted) - script does not execute, not shown in log file
- Delete VRRP configuration entirely on both machines OR remove the transition-script line, add again, save - then everything works again.
- Reboot -> script stops working again
Other
- Script has chmod +x permissions
- Script can be run manually from bash and works
Version
vyos-1.3-beta-202112060443-amd64.iso
Configurations
Only difference is priority
#Node A high-availability { vrrp { group eth0 { interface eth0 no-preempt priority 200 rfc3768-compatibility virtual-address <floating IP> vrid 10 } group eth1 { interface eth1 no-preempt priority 200 rfc3768-compatibility virtual-address <Internal VIP IP> vrid 11 } sync-group MAIN { member eth0 member eth1 transition-script { master /config/scripts/<my script name>.sh } } } }
#Node B high-availability { vrrp { group eth0 { interface eth0 no-preempt priority 100 rfc3768-compatibility virtual-address <floating IP> vrid 10 } group eth1 { interface eth1 no-preempt priority 100 rfc3768-compatibility virtual-address <Internal VIP IP> vrid 11 } sync-group MAIN { member eth0 member eth1 transition-script { master /config/scripts/<my script name>.sh } } } }
Master Script
#!/usr/bin/bash RESERVED_IP_INSTANCE_ID='sanitized' API_KEY='sanitized' VM_INSTANCE_ID='sanitized' #determine if the floating ip has been assigned HAS_FLOATING_IP=`curl -s https://api.vultr.com/v2/reserved-ips/${RESERVED_IP_INSTANCE_ID} -X GET -H "Authorization: Bearer ${API_KEY}"` #debug logger -s ${HAS_FLOATING_IP} #check to see if this instance has the floating ip if [[ "${HAS_FLOATING_IP}" != *"${VM_INSTANCE_ID}"* ]]; then logger -s "This machine does not have a IP assigned to this machine already. Let's assign it." #detach `curl -s "https://api.vultr.com/v2/reserved-ips/${RESERVED_IP_INSTANCE_ID}/detach" \ -X POST \ -H "Authorization: Bearer ${API_KEY}"` #attach `curl -s "https://api.vultr.com/v2/reserved-ips/${RESERVED_IP_INSTANCE_ID}/attach" \ -X POST \ -H "Authorization: Bearer ${API_KEY}" \ -H "Content-Type: application/json" \ -d "{\"instance_id\" : \"${VM_INSTANCE_ID}\"}"` fi logger -s "Completed IP failover" exit
Attaching a screenshot of the script working when keepalived does execute it