# file module can't be opened

**URL:** <https://forum.ansible.com/t/file-module-cant-be-opened/15695>\
**Category:** Ansible Project\
**Created:** [July 17, 2014, 4:46pm UTC](https://forum.ansible.com/t/file-module-cant-be-opened/15695 "2014-07-17T16:46:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nic\_Flores](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@Nic\_Flores](https://forum.ansible.com/u/Nic_Flores)\
**Post date:** [July 17, 2014, 4:46pm UTC](https://forum.ansible.com/t/file-module-cant-be-opened/15695/1 "2014-07-17T16:46:10Z")

</div>

Hey Folks,  
I’m running into the following error. I would appreciate any feedback.

-bash-4.1$ ansible --version  
ansible 1.7 (devel f8bf9cdeec) last updated 2014/06/23 20:27:32 (GMT +000)

-bash-4.1$ ansible-playbook edit\_sdc\_cron.yml -i sdc\_hosts -u ansible --ask-pass -K  
SSH password:  
sudo password [defaults to SSH password]:

PLAY [editing cron] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [sdc-webdev1]

TASK: [copy new backup.sdc file] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [sdc-webdev1]

TASK: [change ownership and permissions of backup.sdc] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [sdc-webdev1] =\> {“failed”: true, “parsed”: false}  
invalid output was:  
SUDO-SUCCESS-euijcvjyrhtiwrgfnxbomdglywckoyub  
/usr/bin/python: can’t open file ‘/home/ansible/.ansible/tmp/ansible-tmp-1405614771.73-68628807032256/file’: [Errno 13] Permission denied

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/ansible/edit\_sdc\_cron.retry

sdc-webdev1 : ok=2 changed=0 unreachable=0 failed=1

-bash-4.1$ cat edit\_sdc\_cron.yml

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 17, 2014, 4:50pm UTC](https://forum.ansible.com/t/file-module-cant-be-opened/15695/2 "2014-07-17T16:50:03Z")

</div>

it seems like your sudo user cannot open the tmp file under teh ansible  
user (your remote\_user)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 17, 2014, 4:51pm UTC](https://forum.ansible.com/t/file-module-cant-be-opened/15695/3 "2014-07-17T16:51:29Z")

</div>

hit enter too early …

my guess is that you are setting sudo\_user to non root and this user cannot read into ansible’s home/tmp folder  
or that you are using root over a filesystem that won’t let you use root privs (i.e NFS).

One way to get around it is setting ANSIBLE\_REMOTE\_TMP to /var/tmp, for example.  
​

---

<div class="post-metadata">

**Author:** ![Nic\_Flores](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@Nic\_Flores](https://forum.ansible.com/u/Nic_Flores)\
**Post date:** [July 17, 2014, 5:42pm UTC](https://forum.ansible.com/t/file-module-cant-be-opened/15695/4 "2014-07-17T17:42:31Z")

</div>

Brian,  
Thanks! I installed an ansible.cfg file in /etc/ansible/ and specified the remote directory to be:

remote\_tmp = /tmp/.ansible/tmp

That fixed my issue.
