{% if type == 'l3' %}
# MULTI ZONE CLUSTER CFG
[general]
multi_zone=enabled
{% for gp in groups | difference(['all','cluster']) %}
{% for server in groups[gp] %}
{% if hostvars[server]['vip'] is defined %}

[{{gp}} CLUSTER]
management_ip={{ hostvars[server]['vip'] }}

[{{gp}} CLUSTER interface {{ hostvars[server]['ansible_facts']['default_ipv4']['alias'] }}]
ip={{ hostvars[server]['vip'] }}
{% endif %}

[{{gp}} {{ server }}]
management_ip={{ hostvars[server]['ansible_host'] }}

[{{gp}} {{ server }} interface {{ hostvars[server]['ansible_facts']['default_ipv4']['alias']}}]
ip={{ hostvars[server]['ansible_host'] }}
{% endfor -%}
{% endfor -%}
{% endif %}
{% if type == 'normal' %}
# NORMAL L2 CLUSTER CFG
{% for gp in groups | difference(['all','cluster']) %}
{% for server in groups[gp] %}
{% if hostvars[server]['vip'] is defined %}

[CLUSTER]
management_ip={{ hostvars[server]['vip'] }}

[CLUSTER interface {{ hostvars[server]['ansible_facts']['default_ipv4']['alias'] }}]
ip={{ hostvars[server]['vip'] }}
{% endif %}

[{{ server }}]
management_ip={{ hostvars[server]['ansible_host'] }}

[{{ server }} interface {{ hostvars[server]['ansible_facts']['default_ipv4']['alias']}}]
ip={{ hostvars[server]['ansible_host'] }}
{% endfor -%}
{% endfor -%}
{% endif %}