haproxy-wi/app/scripts/ansible/roles/keepalived/templates/keepalived.conf.j2

63 lines
1.3 KiB
Django/Jinja

global_defs {
# Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead
router_id LVS_DEVEL
}
{%- if NGINX %}
#NGINX health-check for keepalive
vrrp_script chk_nginx {
script "systemctl is-active --quiet nginx"
interval 2
weight 3
}
{% endif %}
{%- if HAPROXY %}
#HAProxy health-check for keepalive
vrrp_script chk_haproxy {
script "systemctl is-active --quiet haproxy"
interval 2
weight 3
}
{% endif %}
{% for router, vip in routers.items() %}
vrrp_instance VI_{{router}} {
{% for k, slave in vip.items() %}
{% if k == ansible_host and slave is mapping %}
state {% if slave.master %}MASTER{% else %}BACKUP{%endif%}
interface {{slave.eth}}
priority {% if vip.return_master and slave.master %}152{% elif slave.master and not vip.return_master %}102{% else %}101{%endif%}
{% endif %}
{% endfor %}
virtual_router_id {{router}}
#check if we are still running
track_script {
{%- if HAPROXY %}
chk_haproxy
{% endif %}
{%- if NGINX %}
chk_nginx
{% endif %}
}
advert_int 1
authentication {
auth_type PASS
auth_pass VerySecretPass
}
virtual_ipaddress {
{{vip.vip}}
}
}
{% endfor %}
# Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead