file module can't be opened

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

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

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.

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.