FAILED => failed to transfer file to /ping

Hi,

I have just installed ansible on my OSX laptop, and am running through “my first command”. Unfortunately, I am getting the following error:

$ ansible -m ping all -u pas --ask-pass
SSH password:
Traceback (most recent call last):
File “/Users/pas/apps/ansible/lib/ansible/connection.py”, line 163, in put_file
sftp.put(in_path, out_path)
File “/Users/pas/Library/Python/2.7/lib/python/site-packages/paramiko/sftp_client.py”, line 565, in put
fr = self.file(remotepath, ‘wb’)
File “/Users/pas/Library/Python/2.7/lib/python/site-packages/paramiko/sftp_client.py”, line 245, in open
t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
File “/Users/pas/Library/Python/2.7/lib/python/site-packages/paramiko/sftp_client.py”, line 635, in _request
return self._read_response(num)
File “/Users/pas/Library/Python/2.7/lib/python/site-packages/paramiko/sftp_client.py”, line 682, in _read_response
self._convert_status(msg)
File “/Users/pas/Library/Python/2.7/lib/python/site-packages/paramiko/sftp_client.py”, line 710, in _convert_status
raise IOError(errno.EACCES, text)
IOError: [Errno 13] Permission denied
127.0.0.1 | FAILED => failed to transfer file to /ping

Any ideas what is causing this and how I can fix it?

Thanks,
Peter

Questions:

(A) What version (branch?) of Ansible are you using?

(B) What OS is the host that fails?

It looks like a 0.2.X copy to me because newer Ansible uses different tmpdirs per user (which fixes permission problems) and an exception in a transfer should generally be caught and not fail all programs. But I could be wrong.

(I’m very interested in making things easy to use on OS X by the way, I have some tickets open for adapting the modules for managing nodes but obviously a good working control program on OS X is even more useful. Homebrew packaging might also be nice? Or maybe we just say use pip?)

–Michael

Hi Michael,

The version of Ansible I am using is whatever is in the master branch I think:

git clone git://github.com/ansible/ansible.git

The host that fails is also my laptop running OSX 10.7. My hosts file just contains 127.0.0.1.

I am only following instructions here:
http://ansible.github.com/gettingstarted.html#getting-ansible

I look forward to your response,
Peter

Ok, the handling of -u is such that it will assume /home/user as the parent for the temp directory, and OS X is /Users/foo. There could be more involved, but I’m quite interested in a patch that
does this more intelligently.

In other words, not much has been done to handle OS X managed nodes just yet. We’re working on the client (control machine) first, and I imagine that will come later.

Help with this is quite welcome. We’ll also have to make the user, groups, and services module able to detect the OS type and do the right thing (use launchd vs /sbin/service, etc).

–Michael

I've found a bug in how _get_tmp_path works on OSX (10.7 in my case) which
I think is probably causing this problem.

I should have a patch soon...

Chris

Yes, this, the shell invocation needs to involve the user’s homedir location ($HOME, etc) most likely.

See if you can fix it to be OS agnostic.

Ok great. Please let me know once the patch has been applied and I will pull the master branch again and give it a try.

Peter

Yup, that's the easy part, pushed at
https://github.com/cread/ansible/commit/dbb4afff50cc65092f2488af09d878be4d772229

The hard part is that get_interfaces in library/setup does not actually
work for OSX, so we can't use OSX as a client yet (working on it)...

Yup, that’s the easy part, pushed at https://github.com/cread/ansible/commit/dbb4afff50cc65092f2488af09d878be4d772229

pull request please?

The hard part is that get_interfaces in library/setup does not actually work for OSX, so we can’t use OSX as a client yet (working on it)…

Yeah, so “does not actually work” is “does not actually work yet” :slight_smile:

Meaning you will want to update it to know when it’s OS X and at least not include those facts, until the time where they can be added in.

I’d be ok with almost no facts for a first pass.

(detect OS X, decide to skip various facts, which may be most of them)