fabric: clean up formatting for interface templates

Hypothetically.
This commit is contained in:
Timotej Lazar 2025-03-27 11:58:24 +01:00
parent 09eb030e32
commit 39284749f2
2 changed files with 19 additions and 10 deletions

View file

@ -1,8 +1,12 @@
{# Note that there must be exactly one VLAN-aware bridge. #}
{% set bridge = interfaces | selectattr('type') | selectattr('type.value', '==', 'bridge') | first %}
{# interfaces that belong to this bridge #}
{% set ports = interfaces | selectattr('enabled') | selectattr('bridge') | selectattr('bridge.name', '==', bridge.name) %}
{# allowed VLANs can be specified on the bridge, any of its ports, or all VLANs in NetBox #}
{% set bridge = interfaces
| selectattr('type') | selectattr('type.value', '==', 'bridge')
| first %}
{% set ports = interfaces
| selectattr('bridge') | selectattr('bridge.name', '==', bridge.name)
| selectattr('enabled') %}
{#- Allowed VLANs can be specified on the bridge, any of its ports, or all VLANs in NetBox. #}
{% set my_vlans = bridge.tagged_vlans or vlans %}
{% set my_vlan_ids = my_vlans | map(attribute='vid') | sort -%}