From 31e88617f11109078b44327b2abae8f9768e10f7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 24 Jun 2020 03:01:50 +0200 Subject: update ch-router and add ch-nic --- roles/openwrt/image/tasks/fetch.yml | 2 +- roles/vm/network/templates/interfaces.j2 | 18 ++++++++++++++++++ roles/vm/network/templates/resolv.conf.j2 | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openwrt/image/tasks/fetch.yml b/roles/openwrt/image/tasks/fetch.yml index 21bc0c40..05d2ad6e 100644 --- a/roles/openwrt/image/tasks/fetch.yml +++ b/roles/openwrt/image/tasks/fetch.yml @@ -22,7 +22,7 @@ - name: Check OpenPGP signature command: >- - gpg2 --no-options --no-default-keyring --secret-keyring /dev/null + gpg --no-options --no-default-keyring --secret-keyring /dev/null --verify --keyring "{{ role_path }}/openwrt-keyring.gpg" --trust-model always "{{ openwrt_download_dir }}/{{ openwrt_tarball_basename }}.sha256.asc" diff --git a/roles/vm/network/templates/interfaces.j2 b/roles/vm/network/templates/interfaces.j2 index d257a98a..8c288669 100644 --- a/roles/vm/network/templates/interfaces.j2 +++ b/roles/vm/network/templates/interfaces.j2 @@ -17,15 +17,27 @@ iface {{ interface.name }} inet static netmask {{ interface.address | ipaddr('netmask') }} {% if 'overlay' in interface %} up /bin/ip addr add dev $IFACE {{ interface.overlay }}/32 +{% for route in interface.static_routes | default([]) %} + up /bin/ip route add {{ route.destination }} via {{ route.gateway }} src {{ interface.overlay }} +{% endfor %} {% if 'gateway' in interface %} up /bin/ip route add default via {{ interface.gateway }} src {{ interface.overlay }} down /bin/ip route del default via {{ interface.gateway }} src {{ interface.overlay }} +{% for route in interface.static_routes | default([]) | reverse %} + down /bin/ip route del {{ route.destination }} via {{ route.gateway }} src {{ interface.overlay }} +{% endfor %} {% endif %} down /bin/ip addr del dev $IFACE {{ interface.overlay }}/32 {% else %} {% if 'gateway' in interface %} gateway {{ interface.gateway }} {% endif %} +{% for route in interface.static_routes | default([]) %} + up /bin/ip route add {{ route.destination }} via {{ route.gateway }} +{% endfor %} +{% for route in interface.static_routes | default([]) | reverse %} + down /bin/ip route del {{ route.destination }} via {{ route.gateway }} +{% endfor %} {% endif %} {% if 'address6' in interface %} @@ -34,5 +46,11 @@ iface {{ interface.name }} inet6 static {% if 'gateway6' in interface %} gateway {{ interface.gateway6 }} {% endif %} +{% for route in interface.static_routes6 | default([]) %} + up /bin/ip -6 route add {{ route.destination }} via {{ route.gateway }} +{% endfor %} +{% for route in interface.static_routes6 | default([]) | reverse %} + down /bin/ip -6 route del {{ route.destination }} via {{ route.gateway }} +{% endfor %} {% endif %} {% endfor %} diff --git a/roles/vm/network/templates/resolv.conf.j2 b/roles/vm/network/templates/resolv.conf.j2 index f62b6ed7..00aaafe3 100644 --- a/roles/vm/network/templates/resolv.conf.j2 +++ b/roles/vm/network/templates/resolv.conf.j2 @@ -1,4 +1,4 @@ {% for nsrv in network_cooked.nameservers %} nameserver {{ nsrv }} {% endfor %} -search {{ network.domain }} +search {{ network_cooked.domain }} -- cgit v1.2.3