# {{ ansible_managed }} global_defs { notification_email { {% for mail in keepalived_notification_mails %} {{ mail }} {% endfor %} } notification_email_from {{ keepalived_mail_from }} smtp_server {{ keepalived_smtp_server }} } {% for vrrp_script in keepalived_vrrp_scripts %} vrrp_script {{ vrrp_script.name }} script "{{ vrrp_script.script }}" interval {{ vrrp_script.interval|default(2) }} fall {{ vrrp_script.fall|default(2) }} rise {{ vrrp_script.rise|default(2) }} } {% endfor %} {% for vrrp_instance in keepalived_vrrp_instances %} vrrp_instance {{ vrrp_instance.name }} { state {{ vrrp_instance.state|upper }} interface {{ vrrp_instance.interface }} virtual_router_id {{ vrrp_instance.virtual_router_id }} priority {{ vrrp_instance.priority }} {% if 'smtp_alert' in vrrp_instance and vrrp_instance.smtp_alert %} smtp_alert {% endif %} {% if 'authentication' in vrrp_instance %} authentication { auth_type {{ vrrp_instance.authentication.type|upper }} auth_pass {{ vrrp_instance.authentication.pass }} } {% endif %} virtual_ipaddress { {% for ipaddress in vrrp_instance.virtual_ipaddresses %} {{ ipaddress }} {% endfor %} } {% if 'track_scripts' in vrrp_instance %} track_script { {% for script in vrrp_instance.track_scripts %} {{ script }} {% endfor %} } {% endif %} {% if 'notify' in vrrp_instance %} {% for state, script in vrrp_instance.notify.items() %} notify_{{ state }} "{{ script }}" {% endfor %} {% endif %} } {% endfor %}