summaryrefslogtreecommitdiff
path: root/roles/vm/host/network/templates/interfaces.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-22 23:42:03 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-22 23:42:03 +0200
commit8c76a1b0c6e925b529b1cd03ded5b9d0b3d707c4 (patch)
treee3b4ead7fa5fd34f0f64c6b5fe8ebc944ca7bdc0 /roles/vm/host/network/templates/interfaces.j2
parentadd some more interface configs (diff)
yet another refactoring of the network config
Diffstat (limited to 'roles/vm/host/network/templates/interfaces.j2')
-rw-r--r--roles/vm/host/network/templates/interfaces.j244
1 files changed, 30 insertions, 14 deletions
diff --git a/roles/vm/host/network/templates/interfaces.j2 b/roles/vm/host/network/templates/interfaces.j2
index 6daa22bd..284c1cb6 100644
--- a/roles/vm/host/network/templates/interfaces.j2
+++ b/roles/vm/host/network/templates/interfaces.j2
@@ -19,9 +19,9 @@ iface {{ interface }} inet manual
{% for bond in network.bonds | default([]) %}
## Bond: {{ bond.name }}
-{% set tmp = network.interfaces | selectattr('name', 'eq', bond.name) | list %}
+{% set matched = network.interfaces | selectattr('name', 'eq', bond.name) | list %}
auto {{ bond.name }}
-iface {{ bond.name }} inet {{ ((tmp | length) == 0) | ternary('manual', 'static') }}
+iface {{ bond.name }} inet {{ ((matched | length) == 0) | ternary('manual', 'static') }}
up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
bond-mode {{ bond.mode }}
@@ -29,13 +29,21 @@ iface {{ bond.name }} inet {{ ((tmp | length) == 0) | ternary('manual', 'static'
{% for option in (bond.options | default({}) | list | sort) %}
bond-{{ option }} {{ bond.options[option] }}
{% endfor %}
-{% if (tmp | length) > 0 %}
-{% set interface = tmp | first %}
-{% include 'interfaces/' + (interface.config | default('simple')) + '.j2' %}
-{% if 'address6' in interface %}
+{% if (matched | length) > 0 %}
+{% set interface = matched | first %}
+{% if 'content' in interface %}
+ {{ interface.content | indent(2) }}
+{% else %}
+{% include 'interfaces/' + (interface.template | default('simple')) + '.j2' %}
+{% endif %}
+{% if 'content6' in interface or 'address6' in interface %}
iface {{ interface.name }} inet6 static
-{% include 'interfaces/' + (interface.config | default('simple6')) + '.j2' %}
+{% if 'content6' in interface %}
+ {{ interface.content6 | indent(2) }}
+{% else %}
+{% include 'interfaces/' + (interface.template6 | default('simple6')) + '.j2' %}
+{% endif %}
{% endif %}
{% endif %}
@@ -46,18 +54,26 @@ iface {{ interface.name }} inet6 static
{% for vlan in network.vlans[parent] %}
{% set interface_name = parent+'.'+(vlan | string) %}
-{% set tmp = network.interfaces | selectattr('name', 'eq', interface_name) | list %}
+{% set matched = network.interfaces | selectattr('name', 'eq', interface_name) | list %}
auto {{ interface_name }}
-iface {{ interface_name }} inet {{ ((tmp | length) == 0) | ternary('manual', 'static') }}
+iface {{ interface_name }} inet {{ ((matched | length) == 0) | ternary('manual', 'static') }}
up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
-{% if (tmp | length) > 0 %}
-{% set interface = tmp | first %}
-{% include 'interfaces/' + (interface.config | default('simple')) + '.j2' %}
-{% if 'address6' in interface %}
+{% if (matched | length) > 0 %}
+{% set interface = matched | first %}
+{% if 'content' in interface %}
+ {{ interface.content | indent(2) }}
+{% else %}
+{% include 'interfaces/' + (interface.template | default('simple')) + '.j2' %}
+{% endif %}
+{% if 'content6' in interface or 'address6' in interface %}
iface {{ interface.name }} inet6 static
-{% include 'interfaces/' + (interface.config | default('simple6')) + '.j2' %}
+{% if 'content6' in interface %}
+ {{ interface.content6 | indent(2) }}
+{% else %}
+{% include 'interfaces/' + (interface.template6 | default('simple6')) + '.j2' %}
+{% endif %}
{% endif %}
{% endif %}