kolla-ansible/ansible/roles/haproxy/templates/keepalived.conf.j2
Pavel Glushchak 6832e0aad1 keepalived: ability to use unicast instead of multicast
In some data centers multicast traffic is prohibited. Additionally
VRRP id needs to be unique within broadcast domain when keepalived
operates in multicast mode, otherwise it fails to start.

However keepalived can be configured to use unicast traffic [1].
In unicast mode VRRP id doesn't make sense, but needs to be
the same among peers.

[1] http://manpages.ubuntu.com/manpages/zesty/man5/keepalived.conf.5.html

Change-Id: I692ecbb0aa750baf20c013b53b57f88b474b63cc
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2018-02-27 08:00:53 +00:00

47 lines
1.3 KiB
Django/Jinja

vrrp_script check_alive {
script "/check_alive.sh"
interval 2
fall 2
rise 10
}
vrrp_instance kolla_internal_vip_{{ keepalived_virtual_router_id }} {
state BACKUP
nopreempt
interface {{ api_interface }}
virtual_router_id {{ keepalived_virtual_router_id }}
priority {{ groups['haproxy'].index(inventory_hostname) + 1 }}
advert_int 1
{% if keepalived_traffic_mode == 'unicast' %}
unicast_src_ip {{ api_interface_address }}
{% if groups['haproxy'] | length > 1 %}
unicast_peer {
{% for host in groups['haproxy'] %}
{% set ip_addr = hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] %}
{% 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 }}
}
track_script {
check_alive
}
}