ansible/roles/keepalived/templates/keepalived.conf

59 lines
1.2 KiB
Text
Raw Normal View History

2022-01-01 21:45:17 +01:00
{{ ansible_managed | comment }}
global_defs {
dynamic_interfaces
script_user root
enable_script_security
vrrp_version 3
}
vrrp_sync_group group {
group {
instance_v4
instance_v6
}
{% if keepalived_notify_master %}
notify_master "{{ keepalived_notify_master }}"
{% endif %}
{% if keepalived_notify_backup is defined %}
notify_backup "{{ keepalived_notify_backup }}"
{% endif %}
{% if keepalived_notify_fault is defined %}
notify_fault "{{ keepalived_notify_fault }}"
{% endif %}
}
vrrp_instance instance_v4 {
virtual_router_id {{ keepalived_virtual_router_id }}
interface {{ keepalived_interface }}
state BACKUP
priority 250
nopreempt
advert_int 1
accept
virtual_ipaddress {
{% for dev, addrs in keepalived_virtual_addresses_v4.items() %}
{% for addr in addrs %}
{{ addr }} dev {{ dev }}
{% endfor %}
{% endfor %}
}
}
vrrp_instance instance_v6 {
virtual_router_id {{ keepalived_virtual_router_id }}
interface {{ keepalived_interface }}
state BACKUP
priority 250
nopreempt
advert_int 1
accept
virtual_ipaddress {
{% for dev, addrs in keepalived_virtual_addresses_v6.items() %}
{% for addr in addrs %}
{{ addr }} dev {{ dev }}
{% endfor %}
{% endfor %}
}
}