kolla-ansible/ansible/roles/loadbalancer/templates/keepalived/keepalived.conf.j2
Michal Nasiadka a0e614ee10 loadbalancer: Add option to not define track script
We've seen issues in CI when keepalived haproxy check script returns
an error and keepalived is switching to backup and then again to primary
on a single node environment.

Closes-Bug: #2025219

Change-Id: Iba62e76b3cf83f3ade6df81288d2d77129ffc725
2023-06-28 08:58:51 +00:00

51 lines
1.4 KiB
Django/Jinja

{% if keepalived_track_script_enabled | bool %}
vrrp_script check_alive {
script "/check_alive.sh"
interval 2
fall 2
rise 10
}
{% endif %}
vrrp_instance kolla_internal_vip_{{ keepalived_virtual_router_id }} {
state BACKUP
nopreempt
interface {{ api_interface }}
virtual_router_id {{ keepalived_virtual_router_id }}
priority {{ groups['loadbalancer'].index(inventory_hostname) + 1 }}
advert_int 1
{% if keepalived_traffic_mode == 'unicast' %}
unicast_src_ip {{ api_interface_address }}
{% if groups['loadbalancer'] | length > 1 %}
unicast_peer {
{% for host in groups['loadbalancer'] %}
{% set ip_addr = 'api' | kolla_address(host) %}
{% if ip_addr != api_interface_address %}
{{ ip_addr }}
{% endif %}
{% endfor %}
}
{% endif %}
{% endif %}
virtual_ipaddress {
{{ kolla_internal_vip_address }} dev {{ api_interface }}
{% if haproxy_enable_external_vip | bool %}
{{ kolla_external_vip_address }} dev {{ kolla_external_vip_interface }}
{% endif %}
}
{% if haproxy_enable_external_vip | bool and api_interface != kolla_external_vip_interface %}
track_interface {
{{ kolla_external_vip_interface }}
}
{% endif %}
authentication {
auth_type PASS
auth_pass {{ keepalived_password }}
}
{% if keepalived_track_script_enabled | bool %}
track_script {
check_alive
}
{% endif %}
}