From 12a0da6ab8c1dbfc171f895e31e39a9c5a006bcb Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Sat, 14 Sep 2024 12:30:11 +0200 Subject: [PATCH] Don't make VLAN/VXLAN/MACVLAN mutually exclusive Each interface can have multiple VLAN/VXLAN/MACVLAN at the same time and these options are not mutually exclusive. They are mutually exclusive though with Bridge/Bond options, as not applicable when interface is part of the bridge or bond. Change-Id: Ife417a4ec72b561f68bc60f5d5b179b82524ae7a --- templates/systemd-network.j2 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/templates/systemd-network.j2 b/templates/systemd-network.j2 index 75fca96..80af49d 100644 --- a/templates/systemd-network.j2 +++ b/templates/systemd-network.j2 @@ -40,18 +40,22 @@ Gateway={{ item.1.gateway }} 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 %} +{% else %} +{% if 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 %} +{% endfor %} +{% else %} VLAN={{ item.1.vlan }} +{% endif %} {% endif %} -{% elif item.1.macvlan is defined %} +{% if item.1.macvlan is defined %} MACVLAN={{ item.1.macvlan }} -{% elif item.1.vxlan is defined %} +{% endif %} +{% if item.1.vxlan is defined %} VXLAN={{ item.1.vxlan }} +{% endif %} {% endif %} {% if item.1.ipforward is defined %} IPForward={{ (item.1.ipforward | bool) | ternary('yes', 'no') }}