For extra special fun I made up an IP address and used it in delegate_to:
- name: Copy override file for database information
template: >
src=templates/user_data.json
dest={{ aws_settings_override_file_path }}
delegate_to: 34.142.33.2
(sp_devops)GoatRodeo:devops anderson$ ping 34.142.33.2
PING 34.142.33.2 (34.142.33.2): 56 data bytes
Request timeout for icmp_seq 0
TASK: [Copy override file for database information]
***************************
<34.142.33.2> EXEC ['/bin/sh', '-c', 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642 && chmod a+rx
$HOME/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642 && echo
$HOME/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642']
<34.142.33.2> EXEC ['/bin/sh', '-c', u'rc=0; [ -r
"/srv/sp/web/core/AWS_OVERRIDE.json" ] || rc=2; [ -f
"/srv/sp/web/core/AWS_OVERRIDE.json" ] || rc=1; [ -d
"/srv/sp/web/core/AWS_OVERRIDE.json" ] && echo 3 && exit 0;
(/usr/bin/md5sum /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/sbin/md5sum -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/usr/bin/digest -a md5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/sbin/md5 -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/usr/bin/md5 -n /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/bin/md5 -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/usr/bin/csum -h MD5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
(/bin/csum -h MD5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) || (echo
"${rc} /srv/sp/web/core/AWS_OVERRIDE.json")']
<34.142.33.2> PUT
/var/folders/m4/mk3x6q_50dj_50jpx0763lm80000gn/T/tmpBAaq73 TO
/Users/anderson/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642/file
<34.142.33.2> EXEC ['/bin/sh', '-c', '/usr/bin/python
/Users/anderson/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642/file;
rm -rf
/Users/anderson/.ansible/tmp/ansible-tmp-1399401156.95-113268015974642/
>/dev/null 2>&1']
ok: [127.0.0.1] => {"changed": false, "gid": 20, "group": "staff", "mode":
"0644", "owner": "anderson", "path": "/srv/sp/web/core/AWS_OVERRIDE.json",
"size": 312, "state": "file", "uid": 501}
:-)
Regards,
-scott
On Tuesday, May 6, 2014 2:30:53 PM UTC-4, Scott Anderson wrote:
>
>
>
> The directory exists and is writable (it's owned by ubuntu) on the
> delegate_to machine. It does not exist on localhost.
>
> As an additional test, I added the directory on localhost and made it
> writable, at which point the task no longer failed indicating that it is
> running on localhost and not on the delegate_to IP:
>
> (sp_devops)GoatRodeo:devops anderson$ sudo chmod aoug+w /srv/sp/web/core
> Password:
> (sp_devops)GoatRodeo:devops anderson$ ls -Faxl /srv/sp/web/core
> total 0
> drwxrwxrwx 2 root wheel 68 May 6 14:14 ./
> drwxr-xr-x 3 root wheel 102 May 6 14:14 ../
>
> TASK: [debug msg="retrieved_instance.public_ip is
> {{retrieved_instance.public_ip}}"] ***
> ok: [127.0.0.1] => {
> "msg": "retrieved_instance.public_ip is 54.215.196.1"
> }
>
> TASK: [Copy override file for database information]
> ***************************
> <54.215.196.1> EXEC ['/bin/sh', '-c', 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463 && echo
> $HOME/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463']
> <54.215.196.1> EXEC ['/bin/sh', '-c', u'rc=0; [ -r
> "/srv/sp/web/core/AWS_OVERRIDE.json" ] || rc=2; [ -f
> "/srv/sp/web/core/AWS_OVERRIDE.json" ] || rc=1; [ -d
> "/srv/sp/web/core/AWS_OVERRIDE.json" ] && echo 3 && exit 0;
> (/usr/bin/md5sum /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/sbin/md5sum -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/usr/bin/digest -a md5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/sbin/md5 -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/usr/bin/md5 -n /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/bin/md5 -q /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/usr/bin/csum -h MD5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) ||
> (/bin/csum -h MD5 /srv/sp/web/core/AWS_OVERRIDE.json 2>/dev/null) || (echo
> "${rc} /srv/sp/web/core/AWS_OVERRIDE.json")']
> <54.215.196.1> PUT
> /var/folders/m4/mk3x6q_50dj_50jpx0763lm80000gn/T/tmp68MzNT TO
> /Users/anderson/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463/source
> <54.215.196.1> PUT
> /var/folders/m4/mk3x6q_50dj_50jpx0763lm80000gn/T/tmpZah9PU TO
> /Users/anderson/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463/copy
> <54.215.196.1> EXEC ['/bin/sh', '-c', '/usr/bin/python
> /Users/anderson/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463/copy;
> rm -rf
> /Users/anderson/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463/
> >/dev/null 2>&1']
> changed: [127.0.0.1] => {"changed": true, "dest":
> "/srv/sp/web/core/AWS_OVERRIDE.json", "gid": 20, "group": "staff",
> "md5sum": "f1f374872c6ddab3a2b38c1176df2a0a", "mode": "0644", "owner":
> "anderson", "size": 312, "src":
> "/Users/anderson/.ansible/tmp/ansible-tmp-1399400706.01-38026459986463/source",
>
> "state": "file", "uid": 501}
>
> The task is clearly running on 127.0.0.1 and not 54.215.196.1. The "is not
> writable" error apparently is returned for both non-existent and
> non-writable directories.
>
> Regards,
> -scott
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/723182a5-2faa-44af-9aa1-25f5a8cd938f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.