From eef56d2f242eb261fb5a14738fef5846c7b2e5eb Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 22 Dec 2019 23:45:12 +0100 Subject: move to new vm-host network config on ch-atlas --- inventory/host_vars/ch-atlas.yml | 24 ++++++++++++++---------- roles/vm/host/tasks/network.yml | 11 +++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/inventory/host_vars/ch-atlas.yml b/inventory/host_vars/ch-atlas.yml index a131434a..2316d647 100644 --- a/inventory/host_vars/ch-atlas.yml +++ b/inventory/host_vars/ch-atlas.yml @@ -1,14 +1,18 @@ --- vm_host: network: - prefix: 89.106.215.29/28 - gw: 89.106.215.30 - prefix6: 2a02:3e0:407::29/64 - gw6: 2a02:3e0:407::1 dns: - - 89.106.208.7 - - 89.106.208.12 - offsets: - ch-keyserver: 3 - ch-testvm: 4 - r3-vex2: 11 + - 89.106.208.7 + - 89.106.208.12 + bridges: + public: + interfaces: + - eth0 + prefix: 89.106.215.29/28 + gw: 89.106.215.30 + prefix6: 2a02:3e0:407::29/64 + gw6: 2a02:3e0:407::1 + offsets: + ch-keyserver: 3 + ch-testvm: 4 + r3-vex2: 11 diff --git a/roles/vm/host/tasks/network.yml b/roles/vm/host/tasks/network.yml index 5db20e3d..db6bf82d 100644 --- a/roles/vm/host/tasks/network.yml +++ b/roles/vm/host/tasks/network.yml @@ -14,6 +14,9 @@ iface br-{{ item.key }} inet static address {{ item.value.prefix | ipaddr('address') }} netmask {{ item.value.prefix | ipaddr('netmask') }} + {% if 'gw' in item.value %} + gateway {{ item.value.gw }} + {% endif %} {% else %} iface br-{{ item.key }} inet manual {% endif %} @@ -48,6 +51,14 @@ down /sbin/iptables -t nat -D POSTROUTING -o {{ ansible_default_ipv4.interface }} -s {{ item.value.prefix | ipaddr('network/prefix') }} -j SNAT --to {{ ansible_default_ipv4.address }} {% endif %} {% endif %} + {% if 'prefix6' in item.value %} + + iface br-{{ item.key }} inet6 static + address {{ item.value.prefix6 }} + {% if 'gw6' in item.value %} + gateway {{ item.value.gw6 }} + {% endif %} + {% endif %} register: vmhost_bridge_config ## We don't try to be to clever here: aka don't call ifdown before ifup because -- cgit v1.2.3