network/roles/firewall_master/templates/networks.json.j2
2024-03-19 09:45:23 +01:00

12 lines
403 B
Django/Jinja

{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', raw_data=true) -%}
{
{% 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 %}
}