vm/network: Support configuring secondary network interfaces
authornicoo <nicoo@realraum.at>
Fri, 7 Feb 2020 11:52:22 +0000 (12:52 +0100)
committernicoo <nicoo@realraum.at>
Fri, 7 Feb 2020 12:24:43 +0000 (13:24 +0100)
ansible/roles/vm/network/templates/interfaces.j2

index 829a3e7..e632a9d 100644 (file)
@@ -15,3 +15,16 @@ iface {{ network.primary.interface }} inet static
   gateway {{ network.primary.gateway }}
   pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
   pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
+
+{% if 'secondary' in network %}
+# Secondary network interfaces
+{% for iface, v in network['secondary'].items() %}
+auto {{ iface }}
+iface {{ iface }} inet static
+  address {{ v.ip }}
+  netmask {{ v.mask }}
+  pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
+  pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
+
+{% endfor %}
+{% endif %}