diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-07-07 22:09:19 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-07-11 02:29:02 +0200 |
commit | 6eacc2ad5539abf37dc90cd378b44320f7758869 (patch) | |
tree | eacbf207b610a8ee93f830b381d91491671f6ae5 /roles/vm/network | |
parent | ch-oulu: interface config (diff) |
refactor vm role names
Diffstat (limited to 'roles/vm/network')
-rw-r--r-- | roles/vm/network/handlers/main.yml | 3 | ||||
-rw-r--r-- | roles/vm/network/tasks/main.yml | 40 | ||||
-rw-r--r-- | roles/vm/network/templates/interfaces.j2 | 56 | ||||
-rw-r--r-- | roles/vm/network/templates/resolv.conf.j2 | 4 | ||||
-rw-r--r-- | roles/vm/network/templates/systemd.link.j2 | 5 |
5 files changed, 0 insertions, 108 deletions
diff --git a/roles/vm/network/handlers/main.yml b/roles/vm/network/handlers/main.yml deleted file mode 100644 index f967fa86..00000000 --- a/roles/vm/network/handlers/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: rebuild initramfs - command: update-initramfs -u diff --git a/roles/vm/network/tasks/main.yml b/roles/vm/network/tasks/main.yml deleted file mode 100644 index 27a7682a..00000000 --- a/roles/vm/network/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- name: configure systemd link units - when: network_cooked.systemd_link is defined - block: - - name: remove legacy systemd.link units - loop: - - 50-virtio-kernel-names.link - - 99-default.link - file: - name: "/etc/systemd/network/{{ item }}" - state: absent - - - name: install systemd network link units - loop: "{{ network_cooked.systemd_link.interfaces }}" - loop_control: - label: "{{ item.name }}" - index_var: interface_index - template: - src: systemd.link.j2 - dest: "/etc/systemd/network/{{ '%02d' | format(interface_index + 11) }}-{{ item.name }}.link" - notify: rebuild initramfs - - -- name: install basic interface config - template: - src: interfaces.j2 - dest: /etc/network/interfaces - mode: 0644 - -- name: remove resolvconf package - apt: - name: resolvconf - state: absent - force_apt_get: yes - purge: yes - -- name: generate resolv.conf - template: - src: resolv.conf.j2 - dest: /etc/resolv.conf diff --git a/roles/vm/network/templates/interfaces.j2 b/roles/vm/network/templates/interfaces.j2 deleted file mode 100644 index 8c288669..00000000 --- a/roles/vm/network/templates/interfaces.j2 +++ /dev/null @@ -1,56 +0,0 @@ -# This file describes the network interfaces available on your system -# and how to activate them. For more information, see interfaces(5). - -source /etc/network/interfaces.d/* - -# The loopback network interface -auto lo -iface lo inet loopback -{% for interface in network_cooked.interfaces %} - - -auto {{ interface.name }} -iface {{ interface.name }} inet static - pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra - pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf - address {{ interface.address | ipaddr('address') }} - 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 %} - -iface {{ interface.name }} inet6 static - address {{ interface.address6 }} -{% 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 deleted file mode 100644 index 00aaafe3..00000000 --- a/roles/vm/network/templates/resolv.conf.j2 +++ /dev/null @@ -1,4 +0,0 @@ -{% for nsrv in network_cooked.nameservers %} -nameserver {{ nsrv }} -{% endfor %} -search {{ network_cooked.domain }} diff --git a/roles/vm/network/templates/systemd.link.j2 b/roles/vm/network/templates/systemd.link.j2 deleted file mode 100644 index 7093e164..00000000 --- a/roles/vm/network/templates/systemd.link.j2 +++ /dev/null @@ -1,5 +0,0 @@ -[Match] -Path=*pci-0000:01:{{ "%02d" | format(interface_index + 1) }}.0 - -[Link] -Name={{ item.name }} |