title: Replace the whole content of a file using Ansible
body: <p>I would like to be able to replace the whole content of a file using Ansible playbook.</p>
  
  <p>I have written that piece of code already but it seems the use of the wildcard is wrong way to go. </p>
  
  <pre><code>---
    - hosts: my_hosts
      tasks:
       - name: Replace the content of my file
         lineinfile:
           path: /home/user-ansible/test/conf
           regexp: "*"
           line: "{{ lookup('file', '/home/ansible/config/conf') }}"
  </code></pre>