blob: 967dace035fd8d4b86c68ddd682b8c377786089d (
plain) (
tree)
|
|
---
- 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
# 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
enabled: no
masked: yes
when: use_networkd and not chroot
- name: '- when in chroot'
block:
- command: systemctl disable networking.service
- command: systemctl mask networking.service
when: use_networkd and chroot
# vim: set ts=2 sw=2 et:
|