Timotej Lazar
457ab7d3b7
And group them into vrf_prefixes for VLAN networks and bgp_prefixes for servers plugged directly into fabric. This should reduce the number of queries to NetBox when configuring firewalls and exit switches. Not sure but I think set_fact helps to avoid queries (as opposed to setting group_vars).
9 lines
342 B
Django/Jinja
9 lines
342 B
Django/Jinja
{
|
|
{% for vlan, addrs in vrf_prefixes | groupby('vlan.vid') %}
|
|
"{{ addrs[0].vlan.name }}": {
|
|
"ip": {{ addrs | selectattr('family.value', '==', 4) | map(attribute='prefix') | to_json }},
|
|
"ip6": {{ addrs | selectattr('family.value', '==', 6) | map(attribute='prefix') | to_json }}
|
|
}{% if not loop.last %},{% endif +%}
|
|
{% endfor %}
|
|
}
|