From 38ff061f8141124f3c61258a92220aa6cdbf7d9a Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 6 Aug 2024 15:47:05 +0200 Subject: [PATCH] =?UTF-8?q?alpine:=20don=E2=80=99t=20set=20gateway=20for?= =?UTF-8?q?=20interface=20if=20the=20gateway=20is=20that=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/alpine/templates/interfaces.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/alpine/templates/interfaces.j2 b/roles/alpine/templates/interfaces.j2 index 4c9aa95..4a621c4 100644 --- a/roles/alpine/templates/interfaces.j2 +++ b/roles/alpine/templates/interfaces.j2 @@ -9,7 +9,7 @@ iface {{ iface.name }} inet static {% set subnet = ip.address | ipaddr('subnet') %} {% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %} {% set gateway = prefix.custom_fields.gateway.address %} -{% if gateway is defined %} +{% if gateway is defined and gateway != ip.address %} gateway {{ gateway | ipaddr('address') }} {% endif %} {% endfor %}