file module can't be opened

385 views
Skip to first unread message

Nic Flores

unread,
Jul 17, 2014, 12:46:10 PM7/17/14
to ansible...@googlegroups.com
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
---
- name: editing cron
  hosts: sdctest

  tasks:
  - name: copy new backup.sdc file
    copy: src=backup.sdc dest=/tmp/backup.sdc

  - name: change ownership and permissions of backup.sdc
    file: path=/tmp/backup.sdc pathowner=root group=bin mode=700
    sudo: yes

Brian Coca

unread,
Jul 17, 2014, 12:50:05 PM7/17/14
to ansible...@googlegroups.com
it seems like your sudo user cannot open the tmp file under teh ansible user (your remote_user)



--
Brian Coca
Stultorum infinitus est numerus
0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001
Pedo mellon a minno

Brian Coca

unread,
Jul 17, 2014, 12:51:33 PM7/17/14
to ansible...@googlegroups.com
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.

Nic Flores

unread,
Jul 17, 2014, 1:42:31 PM7/17/14
to ansible...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages