summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-08 23:54:02 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-11 02:29:03 +0200
commitf21533408caf5ee34b6e5d4292b300fb29eb5065 (patch)
treed0fca6e63df5b8bfc0bc982a652999379490f483
parenttest new vm/host/network on other machines... (diff)
improved vm/host/network config
-rw-r--r--inventory/host_vars/ch-atlas.yml3
-rw-r--r--inventory/host_vars/ch-oulu.yml1
-rw-r--r--roles/vm/host/network/templates/interfaces.j217
3 files changed, 15 insertions, 6 deletions
diff --git a/inventory/host_vars/ch-atlas.yml b/inventory/host_vars/ch-atlas.yml
index aa2c2e0c..120e007d 100644
--- a/inventory/host_vars/ch-atlas.yml
+++ b/inventory/host_vars/ch-atlas.yml
@@ -9,3 +9,6 @@ network:
# address6: "{{ vm_host.network.bridges.public.prefix6 | ipaddr(vm_host.network.bridges.public.offsets6[inventory_hostname]) | ipaddr('address/prefix') }}"
address6: "{{ vm_host.network.bridges.public.prefix6 | ipaddr(41) | ipaddr('address/prefix') }}"
gateway6: "{{ vm_host.network.bridges.public.gateway6 }}"
+ vlans:
+ eth0:
+ - 502
diff --git a/inventory/host_vars/ch-oulu.yml b/inventory/host_vars/ch-oulu.yml
index e9113e7e..f6ef0e4c 100644
--- a/inventory/host_vars/ch-oulu.yml
+++ b/inventory/host_vars/ch-oulu.yml
@@ -34,7 +34,6 @@ network:
vlans:
bond0: "{{ __vmhost_bridge_interface_zones__['bond0'] | map('extract', network_zones) | map(attribute='vlan') | list }}"
-
apt_repo_components:
- main
- contrib
diff --git a/roles/vm/host/network/templates/interfaces.j2 b/roles/vm/host/network/templates/interfaces.j2
index eebfb8cc..fe57a024 100644
--- a/roles/vm/host/network/templates/interfaces.j2
+++ b/roles/vm/host/network/templates/interfaces.j2
@@ -6,14 +6,19 @@ auto lo
iface lo inet loopback
+## pyhiscal interfaces
+
+{% for interface in network.bonds | default([]) | map(attribute='slaves') | flatten | union(network.vlans | default({}) | list) | difference(network.bonds | default([]) | map(attribute='name') | list) | sort | unique %}
+auto {{ interface }}
+iface {{ interface }} inet manual
+ pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
+ pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
+
+{% endfor %}
+
{% for bond in network.bonds | default([]) %}
## Bond: {{ bond.name }}
-{% for slave in bond.slaves | sort %}
-auto {{ slave }}
-iface {{ slave }} inet manual
-
-{% endfor %}
{% set tmp = network.interfaces | selectattr('name', 'eq', bond.name) | list %}
auto {{ bond.name }}
iface {{ bond.name }} inet {{ ((tmp | length) == 0) | ternary('manual', 'static') }}
@@ -61,6 +66,8 @@ iface {{ interface.name }} inet6 static
{% for vlan in network.vlans[parent] %}
auto {{ parent }}.{{ vlan }}
iface {{ parent }}.{{ vlan }} inet manual
+ up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
+ up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
{# TODO: add interface config like above if (network.interfaces | selectattr('name', 'eq', 'parent+'.'+vlan') | list) > 0 ... #}
{% endfor %}