global_defs { router_id LVS_DEVEL } {%- if NGINX == '1' %} {% set check_service = 'nginx' %} {% else %} {% set check_service = 'haproxy' %} {% endif %} #health-check for keepalive vrrp_script chk_service { script "systemctl is-active --quiet {{ check_service }}" interval 2 weight 3 } vrrp_instance VI_1 { state {{MASTER}} interface {% if MASTER == 'MASTER' %}{{ETH}} {% else %} {{ETH_SLAVE}} {% endif %} virtual_router_id {{router_id}} priority {% if RETURN_TO_MASTER == '1' and MASTER == 'MASTER' %}152{% elif MASTER == 'MASTER' and RETURN_TO_MASTER == '0' %}102{% else %}101{%endif%} #check if we are still running track_script { chk_service } advert_int 1 authentication { auth_type PASS auth_pass VerySecretPass } virtual_ipaddress { {{IP}} } }