role_keepalived/templates/notify.bash.j2

39 lines
743 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_is_master | length > 0 %}
"MASTER")
{{ keepalived_notify_is_master | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify_is_backup | length > 0 %}
"BACKUP")
{{ keepalived_notify_is_backup | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify_is_fault | length > 0 %}
"FAULT")
{{ keepalived_notify_is_fault | indent(4) }}
exit 0
;;
{% endif %}
{% if keepalived_notify_by_default | length > 0 %}
*)
{{ keepalived_notify_by_default | indent(4) }}
exit 1
;;
{% endif %}
esac