diff --git a/tasks/routing.yaml b/tasks/routing.yaml index 4995e08..be2a0fe 100644 --- a/tasks/routing.yaml +++ b/tasks/routing.yaml @@ -42,13 +42,14 @@ marker: " # {mark} ANSIBLE MANAGED STATIC ROUTES" block: | {% for route in static_routes %} - # {{ route.name }} + # {{ route.name }} {% if route.metric is defined %} down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }} up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }} {% else %} down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} + {% endif %} {% endfor %} insertafter: "^iface {{ lan_interface }} inet.*\\n(\\s+.*\\n)*\\s+netmask"