servers/roles/proxmox/templates/interfaces.j2

31 lines
978 B
Django/Jinja

{# Keep vmbr0 named as is and in the main interfaces file so Proxmox can find it. #}
{% set bridge = interfaces | selectattr('type') | selectattr('type.value', '==', 'bridge') | first %}
{% set my_vlan_ids = bridge.tagged_vlans | default([]) | map(attribute='vid') | sort -%}
# Bridge for V(X)LANs.
auto {{ bridge.name }}
iface {{ bridge.name }} inet manual
bridge-vlan-aware yes
bridge-ports regex (vni.*)
bridge-stp off
bridge-fd 0
{% for vid in my_vlan_ids %}
auto vni{{ vid }}
iface vni{{ vid }} inet static
vxlan-id {{ vid }}
bridge-access {{ vid }}
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
{% endfor %}
# In place of vni* interfaces above this should work also but does not.
# Might start working after proxmox upgrades their ifupdown2.
#auto vxlan
#iface vxlan inet static
# bridge-vlan-vni-map {{ my_vlan_ids | zip(my_vlan_ids) | map('join', '=') | join(' ') }}
# bridge-learning off
source /etc/network/interfaces.d/*