summaryrefslogtreecommitdiff
path: root/roles/vm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-02-14 14:42:23 +0100
committerChristian Pointner <equinox@spreadspace.org>2024-02-14 14:42:23 +0100
commite5789acf5d258d10cf80feb4baf06e58d3fae334 (patch)
tree7b4a43e327ba6e53a7d3116ab40b935aac69f1ba /roles/vm
parentele-calypso: add volume for /srv/video (diff)
vm/*/network: add support for additinal addresses
Diffstat (limited to 'roles/vm')
-rw-r--r--roles/vm/guest/network/templates/interfaces/simple.j26
-rw-r--r--roles/vm/host/network/templates/interfaces/simple.j26
2 files changed, 12 insertions, 0 deletions
diff --git a/roles/vm/guest/network/templates/interfaces/simple.j2 b/roles/vm/guest/network/templates/interfaces/simple.j2
index 26e8aec2..67665f57 100644
--- a/roles/vm/guest/network/templates/interfaces/simple.j2
+++ b/roles/vm/guest/network/templates/interfaces/simple.j2
@@ -3,9 +3,15 @@
{% if 'gateway' in interface %}
gateway {{ interface.gateway }}
{% endif %}
+{% for address in interface.additional_addresses | default([]) %}
+ up /bin/ip addr add dev $IFACE {{ address }}/32
+{% endfor %}
{% 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 %}
+{% for address in interface.additional_addresses | default([]) | reverse %}
+ down /bin/ip addr del dev $IFACE {{ address }}/32
+{% endfor %}
diff --git a/roles/vm/host/network/templates/interfaces/simple.j2 b/roles/vm/host/network/templates/interfaces/simple.j2
index 26e8aec2..67665f57 100644
--- a/roles/vm/host/network/templates/interfaces/simple.j2
+++ b/roles/vm/host/network/templates/interfaces/simple.j2
@@ -3,9 +3,15 @@
{% if 'gateway' in interface %}
gateway {{ interface.gateway }}
{% endif %}
+{% for address in interface.additional_addresses | default([]) %}
+ up /bin/ip addr add dev $IFACE {{ address }}/32
+{% endfor %}
{% 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 %}
+{% for address in interface.additional_addresses | default([]) | reverse %}
+ down /bin/ip addr del dev $IFACE {{ address }}/32
+{% endfor %}