So, the problem is that you can't combine lists, but you can merge dicts 
(it's a config setting, default=false).

This will require either a double for loop or, (my preference, especially 
if you are going to use this type of construct a lot) a filter to combine 
them.

# file: /group_vars/tors
--- 
vlans: 
  tor: 
  - name: GLOBAL-VLAN 
    id: 100 
    net: "{{ globalvlan_prefix }}" 
  special: [] ## just so the template doesn't choke



# file: /group_vars/app1switches
--- 
vlans: 
  special: 
  - name: SPECIAL-APP1-VLAN 
    id: 110 
    net: "{{ app1_prefix }}"



# file: /group_vars/app2switches
--- 
vlans: 
  special: 
  - name: SPECIAL-APP2-VLAN 
    id: 120 
    net: "{{ app2_prefix }}"


# file: templates/switches.j2

VLANS = {{vlans|combine_dict}}



-- 
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/08345697-e0ff-402f-8254-2cc21b8e768b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to