role_keepalived/templates/notify.bash.j2

39 lines
720 B
Plaintext
Raw Normal View History

2023-10-10 13:22:58 +00:00
#!/bin/bash
# {{ ansible_managed }}
TYPE=$1
NAME=$2
STATE=$3
{% if keepalived_notify.pre | length > 0 %}
{{ keepalived_notify.pre }}
{% endif %}
# Use keepalived state
case $STATE in
{% if keepalived_notify.master | length > 0 %}
"MASTER")
{{ keepalived_notify.master | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify.backup | length > 0 %}
"BACKUP")
{{ keepalived_notify.backup | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify.fault | length > 0 %}
"FAULT")
{{ keepalived_notify.fault | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify.default | length > 0 %}
*)
{{ keepalived_notify.default | indent(4) }}
exit 1
;;
{% endif %}
esac