- name: Set up dnsmasq hosts register: dnsmasq_hosts become: true ansible.builtin.template: src: hosts.custom.j2 group: root owner: root mode: 0644 dest: /etc/hosts.custom - name: Set up dnsmasq rules register: dnsmasq become: true ansible.builtin.template: src: 02-custom.conf.j2 group: root owner: root mode: 0644 dest: /etc/dnsmasq.d/02-custom.conf - name: Restart PiHole systems when: dnsmasq.changed or dnsmasq_hosts.changed become: true ansible.builtin.command: argv: - pihole - restartdns