add notify script

This commit is contained in:
Bertrand Gouny
2015-06-16 13:07:17 +02:00
parent 64183ccd88
commit a7a68de0df
5 changed files with 36 additions and 0 deletions
@@ -22,4 +22,6 @@ vrrp_instance vip-1 {
auth_type PASS
auth_pass {{ keepalived_password }}
}
{{ keepalived_notify }}
}
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
TYPE=$1
NAME=$2
STATE=$3
case $STATE in
"MASTER") echo "I'm the MASTER! Whup whup."
exit 0
;;
"BACKUP") "Ok, i'm just a backup, great."
exit 0
;;
"FAULT") echo "Fault, what ?"
exit 0
;;
*) echo "Unknown state"
exit 1
;;
esac
@@ -22,6 +22,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then
sed -i "s|{{ keepalived_priority }}|$KEEPALIVED_PRIORITY|g" /etc/keepalived/keepalived.conf
sed -i "s|{{ keepalived_password }}|$KEEPALIVED_PASSWORD|g" /etc/keepalived/keepalived.conf
if [ -n "$KEEPALIVED_NOTIFY" ]; then
sed -i "s|{{ keepalived_notify }}|notify $KEEPALIVED_NOTIFY|g" /etc/keepalived/keepalived.conf
else
sed -i "/{{ keepalived_notify }}/d" /etc/keepalived/keepalived.conf
fi
# unicast peers
KEEPALIVED_UNICAST_PEERS=($KEEPALIVED_UNICAST_PEERS)
for peer in "${KEEPALIVED_UNICAST_PEERS[@]}"
@@ -53,6 +59,9 @@ if [ ! -e "$FIRST_START_DONE" ]; then
sed -i "/{{ keepalived_virtual_ips }}/d" /etc/keepalived/keepalived.conf
fi
cat /etc/keepalived/keepalived.conf
cat /osixia/keepalived/notify-example.sh
fi
touch $FIRST_START_DONE