From f21533408caf5ee34b6e5d4292b300fb29eb5065 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 8 Jul 2020 23:54:02 +0200 Subject: improved vm/host/network config --- inventory/host_vars/ch-atlas.yml | 3 +++ inventory/host_vars/ch-oulu.yml | 1 - roles/vm/host/network/templates/interfaces.j2 | 17 ++++++++++++----- 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 %} -- cgit v1.2.3