aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/tasks/networkd.yml
blob: ecd5d52944c02eb0346d52d6ad0a63662d18defc (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
41
42
43
44
45
46
47
48
49
50
---
- name: Make sure directory exists
  file:
    dest: '/etc/systemd/network'
    state: directory
- name: Get current network config
  shell: 'ls -1 /etc/systemd/network/'
  check_mode: no
  register: network_files_all
- name: Configure network
  copy:
    src: '{{ item }}'
    dest: '/etc/systemd/network/'
  with_fileglob:
    - 'networkd/network/*'
  register: network_files
  notify:
    - restart networkd
- name: Clean up old files
  file:
    path: '/etc/systemd/network/{{ item }}'
    state: absent
  with_items: '{{ network_files_all.stdout_lines }}'
  when: "item not in network_files.results|map(attribute='path')|map('basename')"
  notify:
    - restart networkd

- name: Create systemd-networkd-wait-online drop-in directory
  file:
    dest: '/etc/systemd/system/systemd-networkd-wait-online.service.d'
    state: directory
- name: Don't wait for lan and mgt interfaces to come online
  copy:
    src: networkd/no-lan-mgt.conf
    dest: '/etc/systemd/system/systemd-networkd-wait-online.service.d/no-lan-mgt.conf'

- name: Enable systemd-networkd
  systemd:
    name: systemd-networkd.service
    enabled: yes
    masked: no
    state: started
  when: "'container' not in ansible_env"
- name: '- when in nspawn'
  command: systemctl enable systemd-networkd.service
  args:
    creates: '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service'
  when: "'container' in ansible_env"

# vim: set ts=2 sw=2 et: