Ansible playbook copy failed - msg: could not find src
<p>I am new to ansible and I am trying to clopy a file from one directory to another directory on a remote RH machine using ansible.</p>

<pre><code>---
- hosts: all
  user: root
  sudo: yes
  tasks:

  - name: touch
    file: path=/home/user/test1.txt state=touch

  - name: file
    file: path=/home/user/test1.txt mode=777

  - name: copy
    copy:  src=/home/user/test1.txt dest=/home/user/Desktop/test1.txt
</code></pre>

<p>But it throws error as below</p>

<pre><code>[root@nwb-ansible ansible]# ansible-playbook a.yml -i hosts 
SSH password: 

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [auto-0000000190]

TASK: [touch] ***************************************************************** 
changed: [auto-0000000190]

TASK: [file] ****************************************************************** 
ok: [auto-0000000190]

TASK: [copy] ****************************************************************** 
failed: [auto-0000000190] =&gt; {"failed": true}
msg: could not find src=/home/user/test1.txt

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/root/a.retry

auto-0000000190            : ok=3    changed=1    unreachable=0    failed=1   

[root@nwb-ansible ansible]# 
</code></pre>

<p>The file has created in the directory and both the file and the directory has got permissions 777.</p>

<p>I am getting the same error message if I try to just copy already existing file using ansible.</p>

<p>I have tried as non-root user as well but no success.</p>

<p>Thanks a lot in advance,</p>

<p>Angel</p>