# \- Failed to create tmp directory

**URL:** <https://forum.ansible.com/t/failed-to-create-tmp-directory/37303>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [November 3, 2022, 8:38pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303 "2022-11-03T20:38:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Khochare](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vivek\_Khochare](https://forum.ansible.com/u/Vivek_Khochare)\
**Post date:** [November 3, 2022, 8:38pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/1 "2022-11-03T20:38:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [November 3, 2022, 9:45pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/2 "2022-11-03T21:45:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vivek\_Khochare](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vivek\_Khochare](https://forum.ansible.com/u/Vivek_Khochare)\
**Post date:** [November 4, 2022, 8:35am UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/3 "2022-11-04T08:35:52Z")

</div>

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

But still same error

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [November 4, 2022, 11:03am UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/4 "2022-11-04T11:03:48Z")

</div>

Show your playbook and ansible.cfg.

Walter

---

<div class="post-metadata">

**Author:** ![Vivek\_Khochare](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vivek\_Khochare](https://forum.ansible.com/u/Vivek_Khochare)\
**Post date:** [November 4, 2022, 2:00pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/5 "2022-11-04T14:00:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [November 4, 2022, 2:02pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/6 "2022-11-04T14:02:50Z")

</div>

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

Walter

---

<div class="post-metadata">

**Author:** ![Vivek\_Khochare](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vivek\_Khochare](https://forum.ansible.com/u/Vivek_Khochare)\
**Post date:** [November 4, 2022, 2:04pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/7 "2022-11-04T14:04:35Z")

</div>

Yes.Cisco devices do not have tmp

---

<div class="post-metadata">

**Author:** ![Vivek\_Khochare](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@Vivek\_Khochare](https://forum.ansible.com/u/Vivek_Khochare)\
**Post date:** [November 4, 2022, 2:27pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/8 "2022-11-04T14:27:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [November 4, 2022, 2:57pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/9 "2022-11-04T14:57:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 4, 2022, 2:58pm UTC](https://forum.ansible.com/t/failed-to-create-tmp-directory/37303/10 "2022-11-04T14:58:10Z")

</div>

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.
