global_defs { {% if keepalived_config.vrrp_script is defined %} enable_script_security script_user {{ keepalived_script_user }} {% endif %} {% for key, value in keepalived_config.global_defs.items() %} {% if value | type_debug != 'list' %} {{key}} {{value}} {% else %} {% for list_value in value %} {{key}} {{ list_value }} {% endfor %} {% endif %} {% endfor %} } {% if keepalived_config.vrrp_script is defined %} {% for vrrp_script in keepalived_config.vrrp_script %} vrrp_script {{ vrrp_script }} { {% for key, value in keepalived_config.vrrp_script[vrrp_script].items() %} {% if value | type_debug != 'list' %} {{key}} {{value}} {% else %} {% for list_value in value %} {{key}} {{ list_value }} {% endfor %} {% endif %} {% endfor %} } {% endfor %} {% endif %} {% if keepalived_config.vrrp_track_process is defined %} {% for vrrp_track_process in keepalived_config.vrrp_track_process %} vrrp_track_process {{ vrrp_track_process }} { {% for key, value in keepalived_config.vrrp_track_process[vrrp_track_process].items() %} {% if value | type_debug != 'list' %} {{key}} {{value}} {% else %} {% for list_value in value %} {{key}} {{ list_value }} {% endfor %} {% endif %} {% endfor %} } {% endfor %} {% endif %} {% for vrrp_instance in keepalived_config.vrrp_instance %} vrrp_instance {{ vrrp_instance }} { {% for key, value in keepalived_config.vrrp_instance[vrrp_instance].items() %} {% if value | type_debug != 'list' %} {{key}} {{value}} {% else %} {{ key }} { {% if key == 'unicast_peer' %} {% for list_value in value %} {{ list_value if list_value != ansible_default_ipv4.address }} {% endfor %} {% else %} {% for list_value in value %} {{ list_value }} {% endfor %} {% endif %} } {% endif %} {% endfor %} } {% endfor %}