Help getting Ansible running

I am new to Ansible and cannot seem to get it to work on Ubunto. I am trying a simple command: ansible all -m ping

I get back:

Cannot write to path /home/lee/.ansible/cp
Traceback (most recent call last):
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 70, in _executor_hook
return_data = multiprocessing_runner._executor(host, new_stdin)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 364, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 443, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 579, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
File “/usr/lib/pymodules/python2.7/ansible/runner/connection.py”, line 36, in connect
conn = utils.plugins.connection_loader.get(transport, self.runner, host, port, user=user, password=password, private_key_file=private_key_file)
File “/usr/lib/pymodules/python2.7/ansible/utils/plugins.py”, line 170, in get
return getattr(self._module_cache[path], self.class_name)(*args, **kwargs)
File “/usr/lib/pymodules/python2.7/ansible/runner/connection_plugins/ssh.py”, line 44, in init
self.cp_dir = utils.prepare_writeable_dir(‘$HOME/.ansible/cp’,mode=0700)
File “/usr/lib/pymodules/python2.7/ansible/utils/init.py”, line 205, in prepare_writeable_dir
exit(“Cannot write to path %s” % tree)
File “/usr/lib/pymodules/python2.7/ansible/utils/init.py”, line 122, in exit
sys.exit(rc)
SystemExit: 1
Cannot write to path /home/lee/.ansible/cp
Traceback (most recent call last):
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 70, in _executor_hook
return_data = multiprocessing_runner._executor(host, new_stdin)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 364, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 443, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/lib/pymodules/python2.7/ansible/runner/init.py”, line 579, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
File “/usr/lib/pymodules/python2.7/ansible/runner/connection.py”, line 36, in connect
conn = utils.plugins.connection_loader.get(transport, self.runner, host, port, user=user, password=password, private_key_file=private_key_file)
File “/usr/lib/pymodules/python2.7/ansible/utils/plugins.py”, line 170, in get
return getattr(self._module_cache[path], self.class_name)(*args, **kwargs)
File “/usr/lib/pymodules/python2.7/ansible/runner/connection_plugins/ssh.py”, line 44, in init
self.cp_dir = utils.prepare_writeable_dir(‘$HOME/.ansible/cp’,mode=0700)
File “/usr/lib/pymodules/python2.7/ansible/utils/init.py”, line 205, in prepare_writeable_dir
exit(“Cannot write to path %s” % tree)
File “/usr/lib/pymodules/python2.7/ansible/utils/init.py”, line 122, in exit
sys.exit(rc)
SystemExit: 1

Any help appreciated

Lee

If you re-run the command does it work? Another user opened an issue on github for a similar stack dump.

Looks like this should be raising errors.AnsibleError too instead of SystemExit to avoid the traceback.

We’ll get this fixed ASAP.

Also, could you share some details about your system? Does /home/lee exist? If so, does /home/lee/.ansible and what are the permissions?

What is the ownership/permissions on /home and /home/lee? Are home directories being mounted via NFS, or some other remote file share? Are you running the ansible/ansible-playbook commands via sudo?

Home/lee does exist.
drwxr-xr-x 30 lee lee 4096 Aug 24 16:53 lee

.ansible
drwxr-xr-x 4 root root 4096 Aug 24 17:27 .ansible

Run using sudo:

lee@lee-UB01:~$ sudo ansible all -m ping
[sudo] password for lee:
previous known host file not found
127.0.0.1 | FAILED => could not create temporary directory: SSH exited with return code 255
previous known host file not found
ubuntu.cuevas.com | FAILED => could not create temporary directory: SSH exited with return code 255

Home directories are on a local drive.

Thanks for helping

Are you trying to connect to localhost?

Vincent

Yes

Can you try running with “- c local”

root@lee-UB01:/home/lee# ansible all -m ping -c local
127.0.0.1 | success >> {
“changed”: false,
“ping”: “pong”
}

ubuntu.cuevas.com | success >> {
“changed”: false,
“ping”: “pong”
}

I’m not sure I understand why this worked.

can you try

ssh lee@localhost

ssh may be prompting to add localhost to known_hosts file

Hey guys, all the community debugging is great but let’s just track this on the github and let James and myself handle it for now.

We know it’s not because of known_host prompting, and we already know it’s exclusive to the SSH transport.

Michael,

How do I get this over to Github?

Forgot this wasn’t you.

You can comment on and follow this one:

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

Current data seems to support us just needing to ignore the “already exists” error so James should have a fix pushed soon and we can spin a 1.2.4.

(Note: 1.3 is also due Friday after next)

–Michael