aboutsummaryrefslogtreecommitdiffstats
path: root/roles/fedora/tasks/networkd.yml
blob: 35a45d1bc78917a80c0c6a6a14641bf57c94c13b (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
---
- name: Configure networkd.conf
  vars:
    networkd_conf: '{{ networkd_conf_default|combine(networkd_conf_role) }}'
  ini_file:
    path: '/etc/systemd/networkd.conf'
    no_extra_spaces: yes
    section: "{{ item.key.split('.',1)[0] }}"
    option:  "{{ item.key.split('.',1)[1] }}"
    value:   "{{ (item.value is string)|ternary(item.value,omit) }}"
    state:   "{{ (item.value is string)|ternary('present','absent') }}"
  with_dict: '{{ networkd_conf }}'
  when: use_networkd and (ansible_distribution_version == 'rawhide' or ansible_distribution_version|int > 29

- name: Enable/disable systemd-networkd
  systemd:
    name: systemd-networkd.service
    enabled: "{{ use_networkd|ternary('yes','no') }}"
    masked:  "{{ use_networkd|ternary('no',omit) }}"
    # let the current network daemons run undisturbed until reboot
    # aka. don't cut the pipe we're connected through
    #state:  "{{ use_networkd|ternary('started','stopped') }}"
  when: not chroot
- name: '- when in chroot'
  command: "systemctl {{ use_networkd|ternary('enable','disable') }} systemd-networkd.service"
  when: chroot

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