+ when: ansible_distribution == "Debian" or (ansible_distribution == "Ubuntu" and (ansible_distribution_major_version | int) < 18)
+
+- block:
+ - name: remove default netplan config
+ file:
+ path: /etc/netplan/01-netcfg.yaml
+ state: absent
+
+ - name: install basic netplan config
+ template:
+ src: netplan.yaml.j2
+ dest: "/etc/netplan/01-{{ network.primary.interface }}.yaml"
+ mode: 0644
+
+ when: ansible_distribution == "Ubuntu" and (ansible_distribution_major_version | int) >= 18
+
+- 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