--- - name: Ensure systemd-resolved doesn't interfere ansible.builtin.lineinfile: path: /etc/systemd/resolved.conf regexp: '^DNSStubListener=' insertafter: '^[Resolve]' line: DNSStubListener=no - name: Restart systemd-resolved service ansible.builtin.service: name: systemd-resolved state: restarted - name: Install dnsmasq ansible.builtin.apt: name: dnsmasq state: latest update_cache: true - name: Enable dnsmasq service ansible.builtin.service: name: dnsmasq state: started - name: Start dnsmasq service ansible.builtin.service: name: dnsmasq enabled: true