proxmox: consolidate interface templates

This commit is contained in:
Timotej Lazar 2024-02-26 14:30:17 +01:00
parent 7b4cb8f579
commit 0af8474e52
6 changed files with 23 additions and 29 deletions

View file

@ -12,7 +12,7 @@ router bgp {{ asn.asn }}
neighbor fabric remote-as external
neighbor fabric capability extended-nexthop
{% for iface in interfaces | selectattr('name', 'match', '^lan') %}
{% for iface in interfaces | rejectattr('name', '==', 'lo') | rejectattr('mgmt_only') | rejectattr('vrf') %}
neighbor {{ iface.name }} interface peer-group fabric
neighbor {{ iface.name }} bfd
{% endfor %}

View file

@ -2,7 +2,7 @@
api_filter='name='~cluster) | first -%}
# bridges must be named vmbrN for proxmox to care
{% for vlan in my_cluster.custom_fields.vlans | sort(attribute='vid') %}
{% for vlan in my_cluster.custom_fields.vlans | default([], true) | sort(attribute='vid') %}
auto vmbr{{ vlan.vid }}
iface vmbr{{ vlan.vid }} inet manual
# {{ vlan.name }}

View file

@ -1,14 +1,19 @@
# Management VRF and link.
# Management VRF.
auto mgmt
iface mgmt
address 127.0.0.1/8
address ::1/128
vrf-table auto
{% for iface in interfaces | selectattr('name', 'match', '^mgmt') | selectattr('ip_addresses') %}
{% for iface in interfaces | rejectattr('mgmt_only') %}
auto {{ iface.name }}
iface {{ iface.name }}
vrf mgmt
iface {{ iface.name }} inet {% if iface.name == 'lo' %}loopback{% else %}static{% endif +%}
{% if iface.mtu %}
mtu {{ iface.mtu }}
{% endif %}
{% if iface.vrf %}
vrf {{ iface.vrf.name }}
{% endif %}
{% for ip in iface.ip_addresses %}
address {{ ip.address }}
{% endfor %}
@ -17,4 +22,3 @@ iface {{ iface.name }}
{% endif %}
{% endfor %}