From 9b9f791377a51abab0769405906470398d29c94f Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 23 Dec 2022 17:27:46 +0100 Subject: [PATCH] Allow to provide multiple VLANs In order to create multiple vlans from the same interface, VLAN key must be repeated multiple times. At the moment our role limits that since vlan can not be a list. We adding an option for vlan being a list at the same time keeping backwards compatability. Change-Id: I94bf2157e1e95c3fd5af318eac8238cd6c3b6fdc --- templates/systemd-network.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/systemd-network.j2 b/templates/systemd-network.j2 index e583347..945607d 100644 --- a/templates/systemd-network.j2 +++ b/templates/systemd-network.j2 @@ -49,7 +49,13 @@ Bridge={{ item.1.bridge }} {% elif item.1.bond is defined %} Bond={{ item.1.bond }} {% elif item.1.vlan is defined %} +{% if item.1.vlan is iterable and item.1.vlan is not string %} +{% for vlan in item.1.vlan %} +VLAN={{ vlan }} +{% endfor %} +{% else %} VLAN={{ item.1.vlan }} +{% endif %} {% elif item.1.macvlan is defined %} MACVLAN={{ item.1.macvlan }} {% elif item.1.vxlan is defined %}