--- # The directory is deleted ahead of creation to ensure that no old configs # remain after runnign ansible - name: Delete networkd config directory become: true file: path: /etc/systemd/network state: absent - name: Create the networkd config directory become: true file: path: /etc/systemd/network state: directory - name: Make .network files when: networking is defined become: true template: src: network.j2 dest: "/etc/systemd/network/{{ item.key }}.network" with_dict: "{{ networking }}"