summaryrefslogtreecommitdiff
path: root/roles/vm/network/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vm/network/tasks/main.yml')
-rw-r--r--roles/vm/network/tasks/main.yml19
1 files changed, 17 insertions, 2 deletions
diff --git a/roles/vm/network/tasks/main.yml b/roles/vm/network/tasks/main.yml
index 3d51fff2..9bef36ed 100644
--- a/roles/vm/network/tasks/main.yml
+++ b/roles/vm/network/tasks/main.yml
@@ -9,7 +9,7 @@
state: absent
- name: install systemd network link units
- with_items: "{{ vm_network.systemd_link.interfaces }}"
+ with_items: "{{ network.systemd_link.interfaces }}"
loop_control:
index_var: interface_index
template:
@@ -17,13 +17,28 @@
dest: "/etc/systemd/network/{{ '%02d' | format(interface_index + 11) }}-{{ item.name }}.link"
notify: rebuild initramfs
- when: vm_network.systemd_link is defined
+ when: network.systemd_link is defined
- name: install basic interface config
template:
src: interfaces.j2
dest: /etc/network/interfaces
mode: 0644
+ 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: