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 %}
|
|
|
|
|
2024-05-06 22:47:00 +00:00
|
|
|
# Use keepalived state
|
2023-10-10 13:22:58 +00:00
|
|
|
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
|