- name: nameserver | systemd-resolved | edit config
  lineinfile:
    path: "/etc/systemd/resolved.conf"
    regexp: "^.*DNSStubListener=.*$"
    state: present
    line: "DNSStubListener=no"

- name: nameserver | systemd-resolved | stop and disable service
  service:
    name: "systemd-resolved"
    state: stopped
    enabled: false

- name: nameserver | systemd-resolved | remove /etc/resolv.conf (symlink)
  file:
    path: "/etc/resolv.conf"
    state: absent

- name: nameserver | systemd-resolved | create new /etc/resolv.conf
  copy:
    dest: "/etc/resolv.conf"
    content: |
      nameserver 127.0.0.1
