role_keepalived/templates/notify.bash.j2

39 lines
720 B
Django/Jinja

#!/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