{% set ifaces_fabric = interfaces | selectattr('name', 'match', '^lan') | map(attribute='name') %} set inside { type iface_index elements = { {{ ifaces_fabric | product(['2']) | map('join', '.') | join(', ') }}, wg } } set outside { type iface_index elements = { {{ ifaces_fabric | product(['4']) | map('join', '.') | join(', ') }} } }