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 %}