self-hosting/roles/keepalived-hcloud/templates/keepalived.conf.j2
2019-08-22 05:11:27 +02:00

41 lines
772 B
Django/Jinja

vrrp_script check_nginx {
script /etc/keepalived/check_nginx.sh
interval 3
fall 5
rise 1
}
vrrp_instance VI_1 {
{% if inventory_hostname == groups['kube-node'][0] %}
state MASTER
{% else %}
state BACKUP
{% endif %}
priority 100
interface eth0
virtual_router_id 50
unicast_src_ip {{ hostvars[inventory_hostname]['ipv4'] }}
unicast_peer {
{% for host in (groups['kube-node']) %}
{% if host != inventory_hostname %}
{{ hostvars[host]['ipv4'] }}
{% endif %}
{% endfor %}
}
authentication {
auth_type PASS
auth_pass "{{ keepalived_shared_secret }}"
}
virtual_ipaddress {
{{ floating_ip }}
}
track_script {
chk_haproxy
}
notify /etc/keepalived/hcloud_failover.py
}