--- - 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 - 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: