From aa82e5aa1884075291996a148117800d762eb980 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 19 Mar 2024 09:45:23 +0100 Subject: [PATCH] =?UTF-8?q?firewall=5Fmaster:=20don=E2=80=99t=20define=20i?= =?UTF-8?q?psets=20for=20VLAN=20groups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was a harebrained idea from the start. --- roles/firewall_master/templates/networks.json.j2 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/roles/firewall_master/templates/networks.json.j2 b/roles/firewall_master/templates/networks.json.j2 index 229ad57..1485db9 100644 --- a/roles/firewall_master/templates/networks.json.j2 +++ b/roles/firewall_master/templates/networks.json.j2 @@ -1,6 +1,4 @@ -{% set groups = vlans | map(attribute='name') | select('match', '.+-.+') - | map('split', '-') | map('first') | unique -%} -{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', raw_data=true) %} +{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', raw_data=true) -%} { {% for vlan in vlans %} @@ -8,14 +6,6 @@ "{{ vlan.name }}": { "ip": {{ vlan_prefixes | ipv4 | to_json }}, "ip6": {{ vlan_prefixes | ipv6 | to_json }} - }{% if not loop.last or groups %},{% endif +%} -{% endfor %} - -{% for group in groups %} -{% set group_prefixes = prefixes | selectattr('vlan') | selectattr('vlan.name', 'match', '^'~group) | map(attribute='prefix') %} - "{{ group }}": { - "ip": {{ group_prefixes | ipv4 | to_json }}, - "ip6": {{ group_prefixes | ipv6 | to_json }} }{% if not loop.last %},{% endif +%} {% endfor %} }