# Keeping the ansible tmp/\* files after failed run for debugging

**URL:** <https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 4, 2013, 3:15pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417 "2013-09-04T15:15:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Mitchell](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ryan\_Mitchell](https://forum.ansible.com/u/Ryan_Mitchell)\
**Post date:** [September 4, 2013, 3:15pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/1 "2013-09-04T15:15:31Z")

</div>

I’m having an issue running an ansible task on an endpoint (Windows running Cygwin) that’s failing during fact gathering, of all places. So something is fundamentally wrong, probably related to the recent update of ansible (given that I haven’t had to gather tasks on this system for a while at this point). I’d like to be able to examine the tmp file so I can figure out why the lines are failing - as it seems to be environmental. However, it appears even during a failure that the tmp file is deleted. Is there a switch that I can use to keep the tmp file after a failure so I can read through it on the endpoint?

---

<div class="post-metadata">

**Author:** ![Ryan\_Mitchell](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ryan\_Mitchell](https://forum.ansible.com/u/Ryan_Mitchell)\
**Post date:** [September 4, 2013, 3:36pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/2 "2013-09-04T15:36:46Z")

</div>

Specifically here’s what I’m seeing. It seems like such a fundamental issue that I’m sure it’s environmental. It’s only happening on my windows system out of about 8 others that I’m testing as well. Even a simple one-play ping playbook fails, so something’s clearly not working properly.

failed: [mitchtest03] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 3078, in   
main()  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 2144, in main  
data = run\_setup(module)  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 2082, in run\_setup  
facts = ansible\_facts()  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 2071, in ansible\_facts  
facts.update(Facts().populate())  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 146, in **init**  
self.get\_date\_time\_facts()  
File “/home/trouxadmin/.ansible/tmp/ansible-1378308861.04-273677145818408/setup”, line 437, in get\_date\_time\_facts  
if self.facts[‘date\_time’][‘epoch’][0] == ‘%’:  
IndexError: string index out of range

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 4, 2013, 3:48pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/3 "2013-09-04T15:48:39Z")

</div>

Windows running Cygwin is 100% unsupported and I’m not going to help with that, or accept any patches that allow it.

We’re going to support managing Windows machines in the near future, but not with Cygwin.

Running Ansible form Cygwin is _definitely_ not supported.

---

<div class="post-metadata">

**Author:** ![Ryan\_Mitchell](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ryan\_Mitchell](https://forum.ansible.com/u/Ryan_Mitchell)\
**Post date:** [September 4, 2013, 4:16pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/4 "2013-09-04T16:16:01Z")

</div>

Understood - you’ve educated me on that before. That’s why I was asking how to keep the tmp files so I could examine them myself and see if there’s anything I can do to work around it for now. I’m not asking for help on solving the actual problem on the endpoint. I’m trying to hold out until you have an official approach for Windows but I have to manage them at least at a small level for now.

That said, I worked around this issue by putting the setting “gather\_facts: false” for the plays which point to windows servers. That worked around this issue in terms of the failure itself.

However, it might still be helpful to understand how to make tmp files stick around if you want to examine them on the endpoint after a play or playbook run.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [September 4, 2013, 4:17pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/5 "2013-09-04T16:17:53Z")

</div>

ANSIBLE\_KEEP\_REMOTE\_FILES is what you want.

---

<div class="post-metadata">

**Author:** ![Ryan\_Mitchell](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ryan\_Mitchell](https://forum.ansible.com/u/Ryan_Mitchell)\
**Post date:** [September 4, 2013, 4:44pm UTC](https://forum.ansible.com/t/keeping-the-ansible-tmp-files-after-failed-run-for-debugging/13417/6 "2013-09-04T16:44:47Z")

</div>

Thanks Brian.
