ansible-role-keepalived/templates/keepalived_check_service_st...

20 lines
525 B
Django/Jinja

#!/bin/bash
{% if ansible_distribution_file_variety == "Debian" and ansible_distribution_major_version == '18' %}
am_i_master=$( grep MASTER {{ keepalived_runtime_dir }}/keepalive.state )
keepalive_master=$?
if [ $keepalive_master -eq 0 ] ; then
{% for instance in keepalived_instances %}
{% for addr in instance.v_addr %}
float_ip=$( ip addr show | grep {{ addr }} )
retval=$?
[ $retval -eq 1 ] && /bin/systemctl restart keepalived
{% endfor %}
{% endfor %}
fi
{% endif %}
{{ keepalived_script1_check }}
exit $?