- name: Flush DNS Cache on Remote Hosts
hosts: all
become: yes # Requires root privileges
tasks:
- name: Flush DNS cache using resolvectl (for systemd-resolved)
ansible.builtin.command: resolvectl flush-caches