Add templating of network interfaces

Closes #1
This commit is contained in:
2023-09-01 15:42:21 -04:00
parent cfbe724458
commit c9393ba957
5 changed files with 137 additions and 35 deletions

View File

@ -0,0 +1,13 @@
# PVC node interface-specific interface file - {{ network.key }}
# {{ ansible_managed }}
auto {{ network.value['device'] }}
iface {{ network.value['device'] }} inet manual
post-up ip link set $IFACE mtu {{ network.value['mtu'] }}
{% if network.value['type'] == 'bond' %}
bond_mode {{ network.value['bond_mode'] }}
slaves {% for device in network.value['bond_devices'] %}{{ device }} {% endfor %}
{% endif %}
{% if network.value['type'] == 'vlan' %}
vlan_raw_device {{ network.value['raw_device'] }}
{% endif %}

View File

@ -0,0 +1,10 @@
# PVC node interfaces file
# {{ ansible_managed }}
# Loopback interface
auto lo
iface lo inet loopback
iface lo inet6 loopback
# Include directory
source-directory /etc/network/interfaces.d