[Ansible-Project] - Failed to create tmp directory

759 views
Skip to first unread message

Vivek Khochare

unread,
Nov 3, 2022, 4:39:16 PM11/3/22
to ansible...@googlegroups.com
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

Dick Visser

unread,
Nov 3, 2022, 5:46:13 PM11/3/22
to ansible...@googlegroups.com
Did you follow the recommendation that is literally part of the error message?


--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK32Knon2LonWjyBJ5FvdqEM1ix-rtzwL2ieRR1%3DmH%2BnB8PA-w%40mail.gmail.com.
--
Sent from Gmail Mobile

Vivek Khochare

unread,
Nov 4, 2022, 4:36:17 AM11/4/22
to ansible...@googlegroups.com
Yes..I change the permission for /tmp and also create new path

But still same error

Rowe, Walter P. (Fed)

unread,
Nov 4, 2022, 7:04:10 AM11/4/22
to ansible...@googlegroups.com
Show your playbook and ansible.cfg. 

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Vivek Khochare

unread,
Nov 4, 2022, 10:00:57 AM11/4/22
to ansible...@googlegroups.com
I am trying to check connection for cisco  devices

Below is the command : 

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

In Inventory file I added cisco device IPs



Rowe, Walter P. (Fed)

unread,
Nov 4, 2022, 10:03:09 AM11/4/22
to ansible...@googlegroups.com
Are you delegating the task to localhost? Your cisco devices won't have a /tmp. Right?


Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Vivek Khochare

unread,
Nov 4, 2022, 10:04:58 AM11/4/22
to ansible...@googlegroups.com
Yes.Cisco devices do not have tmp

Vivek Khochare

unread,
Nov 4, 2022, 10:28:21 AM11/4/22
to ansible...@googlegroups.com
Do I need to create /tmp directory on cisco devices?


Rowe, Walter P. (Fed)

unread,
Nov 4, 2022, 10:57:22 AM11/4/22
to ansible...@googlegroups.com
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
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Todd Lewis

unread,
Nov 4, 2022, 10:58:24 AM11/4/22
to ansible...@googlegroups.com, Vivek Khochare, uto...@gmail.com
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.
--
Todd
Reply all
Reply to author
Forward
0 new messages