diff options
author | Emil Renner Berthing <esmil@labitat.dk> | 2018-12-06 20:10:37 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@labitat.dk> | 2018-12-06 20:10:37 +0100 |
commit | 4f30f1583de913c011a6c6a40e53f2e4855eb489 (patch) | |
tree | 5ec3c245a50327f22de823a99b640ab918d67c17 /roles/debian/tasks | |
parent | c624e52a8357da8db022831b86f2c85bb7bfed2f (diff) | |
download | labitat-ansible-4f30f1583de913c011a6c6a40e53f2e4855eb489.tar.gz labitat-ansible-4f30f1583de913c011a6c6a40e53f2e4855eb489.tar.xz labitat-ansible-4f30f1583de913c011a6c6a40e53f2e4855eb489.zip |
debian: networkd: add networkd-wait-online support
Diffstat (limited to 'roles/debian/tasks')
-rw-r--r-- | roles/debian/tasks/networkd.yml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/debian/tasks/networkd.yml b/roles/debian/tasks/networkd.yml index 4dac677..967dace 100644 --- a/roles/debian/tasks/networkd.yml +++ b/roles/debian/tasks/networkd.yml @@ -12,6 +12,37 @@ command: "systemctl {{ use_networkd|ternary('enable','disable') }} systemd-networkd.service" when: chroot +# in Debian 9 (stretch) we need to enable this manually +# this is fixed in buster though +- name: Enable/disable systemd-networkd-wait-online + systemd: + name: systemd-networkd-wait-online.service + enabled: "{{ use_networkd|ternary('yes','no') }}" + masked: no + when: ansible_distribution_release == 'stretch' and not chroot +- name: '- when in chroot' + command: "systemctl {{ use_networkd|ternary('enable','disable') }} systemd-networkd-wait-online.service" + when: ansible_distribution_release == 'stretch' and chroot + +# use RequiredForOnline in systemd.network files if possible, +# but for older systemd's set networkd_ignore: ['eth0', 'eth1'] +- name: Create/remove /etc/systemd/system/systemd-networkd-wait-online.service.d + file: + dest: '/etc/systemd/system/systemd-networkd-wait-online.service.d' + state: "{{ (networkd_ignore|length > 0)|ternary('directory','absent') }}" + owner: root + group: root + mode: 0755 +- name: Don't wait for certain interfaces + template: + dest: '/etc/systemd/system/systemd-networkd-wait-online.service.d/ignore.conf' + src: networkd-ignore.conf.j2 + owner: root + group: root + mode: 0644 + when: networkd_ignore|length > 0 + +# if we use networkd, make sure the networking service is disabled - name: Mask Debian networking.service systemd: name: networking.service |