From e60581e1c8adeb7363c0c00d272db898d64dad51 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 20 Jul 2020 23:26:25 +0200 Subject: vm/host network using ifconfig includes --- roles/vm/host/network/templates/interfaces/simple.j2 | 11 +++++++++++ roles/vm/host/network/templates/interfaces/simple6.j2 | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 roles/vm/host/network/templates/interfaces/simple.j2 create mode 100644 roles/vm/host/network/templates/interfaces/simple6.j2 (limited to 'roles/vm/host/network/templates/interfaces') diff --git a/roles/vm/host/network/templates/interfaces/simple.j2 b/roles/vm/host/network/templates/interfaces/simple.j2 new file mode 100644 index 00000000..c5b7dadc --- /dev/null +++ b/roles/vm/host/network/templates/interfaces/simple.j2 @@ -0,0 +1,11 @@ + address {{ interface.address | ipaddr('address') }} + netmask {{ interface.address | ipaddr('netmask') }} +{% if 'gateway' in interface %} + gateway {{ interface.gateway }} +{% endif %} +{% for route in interface.static_routes | default([]) %} + up /bin/ip route add {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %} +{% endfor %} +{% for route in interface.static_routes | default([]) | reverse %} + down /bin/ip route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %} +{% endfor %} diff --git a/roles/vm/host/network/templates/interfaces/simple6.j2 b/roles/vm/host/network/templates/interfaces/simple6.j2 new file mode 100644 index 00000000..37fda07a --- /dev/null +++ b/roles/vm/host/network/templates/interfaces/simple6.j2 @@ -0,0 +1,10 @@ + address {{ interface.address6 }} +{% if 'gateway6' in interface %} + gateway {{ interface.gateway6 }} +{% endif %} +{% for route in interface.static_routes6 | default([]) %} + up /bin/ip -6 route add {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %} +{% endfor %} +{% for route in interface.static_routes6 | default([]) | reverse %} + down /bin/ip -6 route del {{ route.destination }} via {{ route.gateway }}{% if 'source' in route %} src {{ route.source }}{% endif %} +{% endfor %} -- cgit v1.2.3