# ansible.errors.AnsibleFileNotFound

**URL:** <https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [October 3, 2020, 7:55am UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954 "2020-10-03T07:55:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Schulz](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Robert\_Schulz](https://forum.ansible.com/u/Robert_Schulz)\
**Post date:** [October 3, 2020, 7:55am UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954/1 "2020-10-03T07:55:04Z")

</div>

Hi,

Ansible 2.9.11  
AWX 14.1.0

I run 2 playbooks. One runs on the ansible controler itself and dowloadings a file to /tmp. the 2nd playbook copies that file to a target server. Both playbooks run fine in Ansible CLI but the 2nd one fails at the copy module with file not found. I don’t understand why the file isn’t found under AWX. Any help would be appreciated.

Following the output of the task:

TASK [copy cmk agent deb to target server] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /tmp/awx\_43\_0pq\_lkbj/project/install\_cmk\_agent.yml:12  
\<192.168.105.101\> ESTABLISH SSH CONNECTION FOR USER: sysadmin  
\<192.168.105.101\> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“sysadmin”’ -o ConnectTimeout=10 -o ControlPath=/tmp/awx\_43\_0pq\_lkbj/cp/31bea51285 192.168.105.101 ‘/bin/sh -c ‘"’“‘echo ~sysadmin && sleep 0’”’“‘’  
\<192.168.105.101\> (0, b’/home/sysadmin\n’, b’bash: warning: setlocale: LC\_ALL: cannot change locale (en\_US.UTF-8)\n’)  
\<192.168.105.101\> ESTABLISH SSH CONNECTION FOR USER: sysadmin  
\<192.168.105.101\> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“sysadmin”’ -o ConnectTimeout=10 -o ControlPath=/tmp/awx\_43\_0pq\_lkbj/cp/31bea51285 192.168.105.101 '/bin/sh -c '”‘"’( umask 77 && mkdir -p “`echo /home/sysadmin/.ansible/tmp`”&& mkdir /home/sysadmin/.ansible/tmp/ansible-tmp-1601711309.6230288-5662-129587635544301 && echo ansible-tmp-1601711309.6230288-5662-129587635544301=“`echo /home/sysadmin/.ansible/tmp/ansible-tmp-1601711309.6230288-5662-129587635544301`” ) && sleep 0’“'”‘’  
\<192.168.105.101\> (0, b’ansible-tmp-1601711309.6230288-5662-129587635544301=/home/sysadmin/.ansible/tmp/ansible-tmp-1601711309.6230288-5662-129587635544301\n’, b’bash: warning: setlocale: LC\_ALL: cannot change locale (en\_US.UTF-8)\n’)  
\<192.168.105.101\> ESTABLISH SSH CONNECTION FOR USER: sysadmin  
\<192.168.105.101\> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“sysadmin”’ -o ConnectTimeout=10 -o ControlPath=/tmp/awx\_43\_0pq\_lkbj/cp/31bea51285 192.168.105.101 ‘/bin/sh -c ‘"’“‘rm -f -r /home/sysadmin/.ansible/tmp/ansible-tmp-1601711309.6230288-5662-129587635544301/ \> /dev/null 2\>&1 && sleep 0’”’"‘’  
\<192.168.105.101\> (0, b’‘, b’bash: warning: setlocale: LC\_ALL: cannot change locale (en\_US.UTF-8)\n’)  
The full traceback is:  
Traceback (most recent call last):  
File “/usr/lib/python3.6/site-packages/ansible/plugins/action/copy.py”, line 464, in run  
source = self.\_find\_needle(‘files’, source)  
File “/usr/lib/python3.6/site-packages/ansible/plugins/action/ **init**.py”, line 1192, in \_find\_needle  
return self.\_loader.path\_dwim\_relative\_stack(path\_stack, dirname, needle)  
File “/usr/lib/python3.6/site-packages/ansible/parsing/dataloader.py”, line 327, in path\_dwim\_relative\_stack  
raise AnsibleFileNotFound(file\_name=source, paths=[to\_native(p) for p in search])  
ansible.errors.AnsibleFileNotFound: Could not find or access ‘/tmp/agents/check-mk-agent.deb’ on the Ansible Controller.  
If you are using a module and expect the file to exist on the remote, see the remote\_src option  
fatal: [vpn31]: FAILED! =\> {  
“changed”: false,  
“invocation”: {  
“dest”: “/tmp”,  
“group”: “sysadmin”,  
“mode”: “0755”,  
“module\_args”: {  
“dest”: “/tmp”,  
“group”: “sysadmin”,  
“mode”: “0755”,  
“owner”: “sysadmin”,  
“src”: “/tmp/agents/check-mk-agent.deb”  
},  
“owner”: “sysadmin”,  
“src”: “/tmp/agents/check-mk-agent.deb”  
},  
“msg”: “Could not find or access ‘/tmp/agents/check-mk-agent.deb’ on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote\_src option”

}

Permissions:  
ls -l /tmp  
drwxr-xr-x 3 sysadmin sysadmin 4096 Sep 27 15:47 agents

ls -l /tmp/agents/  
-rw-r–r-- 1 sysadmin sysadmin 26640 Sep 27 15:47 check-mk-agent.deb  
-rw-r–r-- 1 sysadmin sysadmin 5214208 Sep 27 15:47 check\_mk\_agent.msi  
-rw-r–r-- 1 sysadmin sysadmin 33728 Sep 27 15:47 check-mk-agent.rpm

regards Robert

---

<div class="post-metadata">

**Author:** ![Alexsey\_S](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alexsey\_S](https://forum.ansible.com/u/Alexsey_S)\
**Post date:** [October 3, 2020, 7:17pm UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954/2 "2020-10-03T19:17:01Z")

</div>

Hi,  
without seeing playbook hard to say, but

I personally would use a webdav server to move files between source/destination, this way no matter were u run playbook file location will be same.

Good Luck!

---

<div class="post-metadata">

**Author:** ![Robert\_Schulz](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Robert\_Schulz](https://forum.ansible.com/u/Robert_Schulz)\
**Post date:** [October 4, 2020, 11:20am UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954/3 "2020-10-04T11:20:28Z")

</div>

I cannot post a messages, always deleted. Trying to post it partially.  
Hi,

Following my 2 playbooks.  
Why I want to use that method. I have several servers running in different security zones. Only the ansible controller has access to that servers via ssh. This method don’t require an additional firewall rule and I want to avoid it.

regards Robert

---

<div class="post-metadata">

**Author:** ![Robert\_Schulz](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Robert\_Schulz](https://forum.ansible.com/u/Robert_Schulz)\
**Post date:** [October 4, 2020, 11:30am UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954/4 "2020-10-04T11:30:31Z")

</div>

The playbook coding is always deleted. Trying as attachment.  
Playbook1: download file to ansible controller.  
This playbook runs on the ansible controller as target and it runs fine in both CLI and AWX. The file will be created at the given location.

Playbook2: copy file to target server  
This runs on the target server where to install the package. It runs fine in CLI but fails in AWX

> **(attachments)**
>
> [Playbook1](https://forum.ansible.com/uploads/short-url/2Pr2TsJpqNweXUNm3xrg0XJzGgu) (127 Bytes)  
> [Playbook2](https://forum.ansible.com/uploads/short-url/4KNpS7K42jNHgUKukCehOpsowvH) (170 Bytes)

---

<div class="post-metadata">

**Author:** ![Robert\_Schulz](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Robert\_Schulz](https://forum.ansible.com/u/Robert_Schulz)\
**Post date:** [October 5, 2020, 12:34pm UTC](https://forum.ansible.com/t/ansible-errors-ansiblefilenotfound/33954/5 "2020-10-05T12:34:13Z")

</div>

I’ve found the reason. AWX is running in a container. The directory where the file resides must be mounted into the container.
