summaryrefslogtreecommitdiff
path: root/roles/vm/network/tasks/main.yml
blob: 27a7682a72dec956c1d91fac0f95e621cbff9fdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- 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