- Failed to create tmp directory

Hi All
I am getting the error "Failed to create temporary directory.In Some Cases,you may have been able to authenticate and did not have permission on the target directory.Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp"

Can someone please help me on this?

Thanks

Did you follow the recommendation that is literally part of the error message?

Yes…I change the permission for /tmp and also create new path

But still same error

Show your playbook and ansible.cfg.

Walter

I am trying to check connection for cisco devices

Below is the command :

ansible all -i -m ping -u <usr_name> -k

In Inventory file I added cisco device IPs

Are you delegating the task to localhost? Your cisco devices won’t have a /tmp. Right?

Walter

Yes.Cisco devices do not have tmp

Do I need to create /tmp directory on cisco devices?

I think you need a “delegate: localhost” on your task assuming your local control node has a /tmp. The idea is you want the ping to be executed on the localhost (control node).

control node (localhost) => pings => remote device 1

control node (localhost) => pings => remote device …

control node (localhost) => pings => remote device N

Walter

You should not create /tmp directories on Cisco devices that don’t already have them.

We don’t know what Cisco devices you have. Typically, you run Cisco modules using the task level “delegate:” parameter to run them on either the local host (the ansible controller) or some other host that has appropriate network access. The modules use the appropriate API to access the Cisco devices from the delegated host.

The “ping” module you used before is not an ICMP ping. It’s a “yes I can ssh into the remote host and there’s an appropriate python installed there” test. Which for Cisco devices is totally inappropriate anyway.

Walter asked if you were delegating to localhost, and whether your Cisco devices have a /tmp. You answered “yes”, but didn’t say which question you were answering.

If you aren’t delegating to either localhost or some other host with appropriate network access to the Cisco APIs, you will likely not have success. The Cisco devices I’m aware of will not play nicely with attempted ssh connections, which is what your “ping” attempt was trying to do.

Some hosts can be managed by ssh’ing in and using password-less sudo commands – that’s the common paradigm. Not so with many dedicated network devices like Cisco. Those you access via an authenticated API from a designated host (“delegate:”) and modules that speak those APIs.