# Intermittent \_delete\_remote\_files failure

**URL:** <https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 14, 2012, 6:17pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893 "2012-09-14T18:17:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Rudenberg](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jonathan\_Rudenberg](https://forum.ansible.com/u/Jonathan_Rudenberg)\
**Post date:** [September 14, 2012, 6:17pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/1 "2012-09-14T18:17:07Z")

</div>

I'm running ansible-playbook across five hosts on EC2, and on just about every run, one or more host fails with this error:

fatal: [REDACTED.ec2.internal] =\> Traceback (most recent call last):  
&nbsp;&nbsp;File "/usr/lib/pymodules/python2.7/ansible/runner/\_\_init\_\_.py", line 427, in \_executor  
&nbsp;&nbsp;&nbsp;&nbsp;exec\_rc = self.\_executor\_internal(host)  
&nbsp;&nbsp;File "/usr/lib/pymodules/python2.7/ansible/runner/\_\_init\_\_.py", line 478, in \_executor\_internal  
&nbsp;&nbsp;&nbsp;&nbsp;return self.\_executor\_internal\_inner(host, inject, port)  
&nbsp;&nbsp;File "/usr/lib/pymodules/python2.7/ansible/runner/\_\_init\_\_.py", line 595, in \_executor\_internal\_inner  
&nbsp;&nbsp;&nbsp;&nbsp;self.\_delete\_remote\_files(conn, tmp)  
&nbsp;&nbsp;File "/usr/lib/pymodules/python2.7/ansible/runner/\_\_init\_\_.py", line 152, in \_delete\_remote\_files  
&nbsp;&nbsp;&nbsp;&nbsp;raise Exception("not going to happen")  
Exception: not going to happen

The play, action and host where the failure occurs on seem to be completely random.

$ lsb\_release -d  
Description: Ubuntu 12.04.1 LTS  
$ uname -a  
Linux 3.2.0-30-virtual #48-Ubuntu SMP Fri Aug 24 17:12:24 UTC 2012 x86\_64 x86\_64 x86\_64 GNU/Linux  
$ ansible --version  
ansible 0.7

Any suggestions would be appreciated.

Thanks,

Jonathan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 14, 2012, 6:30pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/2 "2012-09-14T18:30:44Z")

</div>

The 'not going to happen' safeguard is to keep 'delete remote files'  
from deleting any path that does not have the substring "/tmp/" in it.  
&nbsp;&nbsp;It's a safeguard that should never have to be triggered.

Did you perhaps set ANSIBLE\_REMOTE\_TEMP (an internals way of  
overriding ansible's choice of where to throw files, and not really  
needed to be set in nearly any cases anymore) to some directory that  
does not contain the path "/tmp/" in it? Or fiddle with the  
associated setting in the config file? That's the only cause I can  
immediately think of.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rudenberg](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jonathan\_Rudenberg](https://forum.ansible.com/u/Jonathan_Rudenberg)\
**Post date:** [September 14, 2012, 6:35pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/3 "2012-09-14T18:35:33Z")

</div>

No, ANSIBLE\_REMOTE\_TEMP is not set, and I haven't configured anything related to file storage locations.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rudenberg](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jonathan\_Rudenberg](https://forum.ansible.com/u/Jonathan_Rudenberg)\
**Post date:** [September 14, 2012, 6:42pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/4 "2012-09-14T18:42:05Z")

</div>

I've isolated the problem to the 'ssh' transport, which I was mistakenly using. It appears that the default 'paramiko' transport doesn't have this problem.

Jonathan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 14, 2012, 6:44pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/5 "2012-09-14T18:44:28Z")

</div>

So you've isolated it... But why is it happening? Let's find out why  
and fix it.

You are the first I've ever heard of this and am curious as to what's up.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rudenberg](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jonathan\_Rudenberg](https://forum.ansible.com/u/Jonathan_Rudenberg)\
**Post date:** [September 14, 2012, 6:45pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/6 "2012-09-14T18:45:48Z")

</div>

Sure, I'm happy to help find the exact issue. I don't really know much about the codebase so I'm not sure what to try next, let me know if you have suggestions.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 14, 2012, 6:51pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/7 "2012-09-14T18:51:46Z")

</div>

For starters, inside of the delete\_remote\_files function  
(lib/ansible/runner/\_\_init\_\_.py) I would temporarily modify the code  
to print out the filename it is trying to delete prior to deleting the  
exception, or to include the path it is trying to delete inside the  
exception message.

I can't see anything offhand that would make it connection type specific.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rudenberg](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jonathan\_Rudenberg](https://forum.ansible.com/u/Jonathan_Rudenberg)\
**Post date:** [September 14, 2012, 7:49pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/8 "2012-09-14T19:49:30Z")

</div>

The file it's trying to delete is '/', while the rest look like '/home/ubuntu/.ansible/tmp/ansible-1347652098.09-222583577850753/'.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 14, 2012, 8:10pm UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/9 "2012-09-14T20:10:16Z")

</div>

Ok, find out why it thinks it wants to delete / 🙂

Thankfully it is smart enough to not do it 🙂

---

<div class="post-metadata">

**Author:** ![Dietmar\_Schinnerl](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dietmar\_Schinnerl](https://forum.ansible.com/u/Dietmar_Schinnerl)\
**Post date:** [September 20, 2012, 7:47am UTC](https://forum.ansible.com/t/intermittent-delete-remote-files-failure/11893/10 "2012-09-20T07:47:40Z")

</div>

Hi there,

sorry for not dropping in earlier.

I had the same / similar issue ages ago: [https://github.com/ansible/ansible/issues/848](https://github.com/ansible/ansible/issues/848)

Although not sure if the current issue is related to this, but may it helps to track it down?

Dietmar.
