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

59 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-11-03 14:43:45 +00:00
global_defs {
# Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead
2019-11-03 14:43:45 +00:00
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"
2019-11-03 14:43:45 +00:00
interval 2
weight 3
2019-11-03 14:43:45 +00:00
}
{% endif %}
{% for router, vip in routers.items() %}
{% for vrrp, s in vip.items() %}
vrrp_instance VI_{{router}} {
state {{s.master}}
interface {{s.eth}}
virtual_router_id {{router}}
priority {% if s.return_master and s.master %}152{% elif s.master and not s.return_master %}102{% else %}101{%endif%}
2019-11-03 14:43:45 +00:00
#check if we are still running
track_script {
{%- if HAPROXY %}
chk_haproxy
{% endif %}
{%- if NGINX %}
chk_nginx
{% endif %}
2019-11-03 14:43:45 +00:00
}
advert_int 1
authentication {
auth_type PASS
auth_pass VerySecretPass
}
virtual_ipaddress {
{{vrrp}}
2019-11-03 14:43:45 +00:00
}
2019-11-06 15:15:41 +00:00
}
{% endfor %}
{% endfor %}
# Managed by Roxy-WI do not edit this file. Use HA cluster configuration instead