Git clone no working after upgrade

Hey All,

I just upgraded from 1.5.5 to 1.6.1 and am seeing the following error happen when trying to clone a repo:

failed: [w4.website.net] => {“failed”: true, “item”: “”, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “”, line 1911, in
File “”, line 503, in main
File “”, line 184, in write_ssh_wrapper
File “/usr/lib/python2.7/tempfile.py”, line 300, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File “/usr/lib/python2.7/tempfile.py”, line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: ‘/home/my_ansible_user/OKKarN’

My Ansible task for is as follows:

  • name: copy code from repository
    sudo_user: my_git_user
    git: repo={{ git[‘repo_url’] }}
    dest={{ install_dir }}
    key_file=“/home/my_git_user/.ssh/deploy.key”
    version={{ git[‘branch’] }}
    depth=1
    accept_hostkey=yes
    register: clone_result
    notify: restart php5-fpm

I see no reason why I’m now getting a permission denied error when I didn’t before.

Any ideas?

Thanks!

James

I’m not sure why you are getting this either.

If you can come up with a way to replicate this on a clean system, can you please run this in “-vvvv” mode and file this as a bug ticket with steps to reproduce?

Either way, a traceback in Ansbile is always a bug, so I’d like a bug ticket even if the system was in a state where it didn’t have legitimate permissions.

We just need more info about how how to reproduce this.

The best I could do was fire up a clean Vagrant instance and run through things from the start. The result was the same.

Here is the output from the task that failed with “-vvvv” set:

TASK: [deploy | copy code from repository] ************************************
<33.33.33.71> ESTABLISH CONNECTION FOR USER: vagrant
<33.33.33.71> REMOTE_MODULE git repo=git@github.com:company/project.git dest=/srv/project key_file=“/home/deploy_user/.ssh/deploy.key” version=master depth=1 accept_hostkey=yes
<33.33.33.71> EXEC [‘ssh’, ‘-C’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/james/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘IdentityFile=/Users/james/.vagrant.d/insecure_private_key’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=vagrant’, ‘-o’, ‘ConnectTimeout=10’, ‘33.33.33.71’, u’/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=bjabkvmkprzchfetqhbbnzyubjbrjjoq] password: " -u deploy_user /bin/sh -c '”'“'echo SUDO-SUCCESS-bjabkvmkprzchfetqhbbnzyubjbrjjoq; LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python'”'"''']
failed: [prod.project.dev] => {“failed”: true, “item”: “”, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “”, line 1911, in
File “”, line 503, in main
File “”, line 184, in write_ssh_wrapper
File “/usr/lib/python2.7/tempfile.py”, line 300, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File “/usr/lib/python2.7/tempfile.py”, line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: ‘/home/vagrant/ysynAz’
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1

FATAL: all hosts have already failed – aborting

I will file an official bug ticket shortly. Thanks!

James

Here’s a link to the bug I filed.

https://github.com/ansible/ansible/issues/7383

The sudo_user is my_git_user, but I'm guessing the connection user is my_ansible_user. When ansible calls sudo, the temp dir value is passed on unchanged. So, it then tried to create a temp file in the wrong location.

I seem to recall reading in the documentation that direct user->user sudo was problematic, due to permission issues with the incoming script+payload; it would end up making the file word readable temporarily. This could be a similar problem.