From 83abc1f5cdb06e71e8674480d59a02365a967750 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 7 Feb 2020 12:52:22 +0100 Subject: [PATCH] vm/network: Support configuring secondary network interfaces --- ansible/roles/vm/network/templates/interfaces.j2 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ansible/roles/vm/network/templates/interfaces.j2 b/ansible/roles/vm/network/templates/interfaces.j2 index 829a3e7..e632a9d 100644 --- a/ansible/roles/vm/network/templates/interfaces.j2 +++ b/ansible/roles/vm/network/templates/interfaces.j2 @@ -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 %} -- 1.7.10.4