diff options
Diffstat (limited to 'roles/vm/network/tasks')
-rw-r--r-- | roles/vm/network/tasks/lan.yml | 6 | ||||
-rw-r--r-- | roles/vm/network/tasks/main.yml | 40 | ||||
-rw-r--r-- | roles/vm/network/tasks/public.yml | 33 | ||||
-rw-r--r-- | roles/vm/network/tasks/systemd-link.yml | 15 |
4 files changed, 34 insertions, 60 deletions
diff --git a/roles/vm/network/tasks/lan.yml b/roles/vm/network/tasks/lan.yml deleted file mode 100644 index ec436e9b..00000000 --- a/roles/vm/network/tasks/lan.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: install interface config (LAN only) - template: - src: interfaces_lan.j2 - dest: /etc/network/interfaces - mode: 0644 diff --git a/roles/vm/network/tasks/main.yml b/roles/vm/network/tasks/main.yml index 222a350b..3d51fff2 100644 --- a/roles/vm/network/tasks/main.yml +++ b/roles/vm/network/tasks/main.yml @@ -1,9 +1,37 @@ --- -- import_tasks: systemd-link.yml - when: srv_network.systemd_link is defined +- block: + - name: remove legacy systemd.link units + with_items: + - 50-virtio-kernel-names.link + - 99-default.link + file: + name: "/etc/systemd/network/{{ item }}" + state: absent -- import_tasks: public.yml - when: srv_network.public is defined + - name: install systemd network link units + with_items: "{{ vm_network.systemd_link.interfaces }}" + loop_control: + index_var: interface_index + template: + src: systemd.link.j2 + dest: "/etc/systemd/network/{{ '%02d' | format(interface_index + 11) }}-{{ item.name }}.link" + notify: rebuild initramfs -- import_tasks: lan.yml - when: srv_network.public is not defined + when: vm_network.systemd_link is defined + +- name: install basic interface config + template: + src: interfaces.j2 + dest: /etc/network/interfaces + mode: 0644 + +- name: remove resolvconf package + apt: + name: resolvconf + state: absent + purge: yes + +- name: generate resolv.conf + template: + src: resolv.conf.j2 + dest: /etc/resolv.conf diff --git a/roles/vm/network/tasks/public.yml b/roles/vm/network/tasks/public.yml deleted file mode 100644 index 8b0e317a..00000000 --- a/roles/vm/network/tasks/public.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: set routing table names - with_items: - - { regexp: '^89\s', line: '89 mur-default' } - - { regexp: '^212\s', line: '212 upc-default' } - lineinfile: - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - dest: /etc/iproute2/rt_tables - -- name: calculate address lists - set_fact: - srv_network_public_firewall_ipv4: - - "{{ srv_network.public.ip_mur }}" - - "{{ srv_network.public.ip_upc }}" - srv_network_public_firewall_ipv6: - - "{{ srv_network.public.ip_mur6 }}" - -- name: install firewall scripts - with_items: - - 4 - - 6 - template: - src: firewall.sh_public.j2 - dest: "/etc/network/firewall{{ item }}.sh" - mode: 0755 - when: srv_network.public.firewall is defined - -- name: install interface config (Public) - template: - src: interfaces_public.j2 - dest: /etc/network/interfaces - mode: 0644 diff --git a/roles/vm/network/tasks/systemd-link.yml b/roles/vm/network/tasks/systemd-link.yml deleted file mode 100644 index ad12cd37..00000000 --- a/roles/vm/network/tasks/systemd-link.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: remove legacy systemd.link units - file: - name: "/etc/systemd/network/{{ item }}" - state: absent - with_items: - - 50-virtio-kernel-names.link - - 99-default.link - -- name: install systemd network link units - template: - src: systemd.link.j2 - dest: "/etc/systemd/network/{{ '%02d' | format(item.idx + 10) }}-{{ item.name }}.link" - with_items: "{{ srv_network.systemd_link.interfaces }}" - notify: rebuild initramfs |