You could also create a VIP list in 'all' and then reference them in the 
group_vars:

group_vars/all/vips:
all_vips:
  - name: cluster1_vip
    ip : 1.2.3.4
    otherattr: yes
  - name: cluster1_othervip
    ip : 1.2.3.5
    otherattr: yes
  - name: cluster2_vip
    ip : 1.2.4.4
    otherattr: yes
  - name: cluster2_othervip
    ip : 1.2.4.5
    otherattr: yes



group_vars/firstcluster:
vips:
  - cluster1_vip
  - cluster1_othervip



group_vars/secondcluster:
vips:
  - cluster2_vip
  - cluster2_othervip



templates/zone.j2
{% for vip in all_vips %}
{{ vip.name }}      IN A     {{ vip.ip }}
{% end for %}



templates/vips.j2 
{% for vip_name in vips %}
{% for vip in all_vips|selectattr("name", "equalto", vip_name) %}
virtual server {{ vip.name }} {{ vip.ip }}
{% endfor %}{# vip #}
{% endfor %}{# vip_name #}





-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/31f58b5e-8928-4265-8492-868edea71962%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to