--- - name: Remove localhost hostname definition lineinfile: path: /etc/hosts # hostnamectl doesn't update the hostname in this entry, so we can't # match against {{ ansible_facts['nodename'] }}. regexp: "^127\\.0\\.1\\.1[ \\t]+" state: absent