summaryrefslogtreecommitdiff
path: root/roles/vm/host/network/templates/interfaces/simple.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-20 23:26:25 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-20 23:26:25 +0200
commite60581e1c8adeb7363c0c00d272db898d64dad51 (patch)
tree06dd8a71421ebd17ceb544702c3f37e67a23d5c3 /roles/vm/host/network/templates/interfaces/simple.j2
parentvm/guest/network: simplify template (diff)
vm/host network using ifconfig includes
Diffstat (limited to 'roles/vm/host/network/templates/interfaces/simple.j2')
-rw-r--r--roles/vm/host/network/templates/interfaces/simple.j211
1 files changed, 11 insertions, 0 deletions
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 %}