summaryrefslogtreecommitdiff
path: root/roles/vm/network/tasks/main.yml
blob: b17aba8b0544dec134eaf64405f2d62d52793125 (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
---
- 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.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

  when: 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
    force_apt_get: yes
    purge: yes

- name: generate resolv.conf
  template:
    src: resolv.conf.j2
    dest: /etc/resolv.conf