---
-- 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
+- name: install classic network config
+ import_tasks: classic.yml
+ when: ansible_distribution == "Debian" or (ansible_distribution == "Ubuntu" and (ansible_distribution_major_version | int) < 18)
- - 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: "{{ vm_network.systemd_link.interfaces }}"
- notify: rebuild initramfs
+- name: install basic netplan config
+ import_tasks: netplan.yml
+ when: ansible_distribution == "Ubuntu" and (ansible_distribution_major_version | int) >= 18
- when: vm_network.systemd_link is defined
+- name: remove resolvconf package
+ apt:
+ name: resolvconf
+ state: absent
+ purge: yes
-- name: install basic interface config
+- name: generate resolv.conf
template:
- src: interfaces.j2
- dest: /etc/network/interfaces
- mode: 0644
+ src: resolv.conf.j2
+ dest: /etc/resolv.conf