network/roles/firewall_master/templates/networks.json.j2

12 lines
403 B
Plaintext
Raw Normal View History

{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', raw_data=true) -%}
2023-12-18 10:22:14 +00:00
{
{% for vlan in vlans %}
{% set vlan_prefixes = prefixes | selectattr('vlan') | selectattr('vlan.id', '==', vlan.id) | map(attribute='prefix') %}
"{{ vlan.name }}": {
"ip": {{ vlan_prefixes | ipv4 | to_json }},
"ip6": {{ vlan_prefixes | ipv6 | to_json }}
}{% if not loop.last %},{% endif +%}
{% endfor %}
}