# Ansible LOCAL\_TMP too many empty directories

**URL:** <https://forum.ansible.com/t/ansible-local-tmp-too-many-empty-directories/27872>\
**Category:** Ansible Project\
**Created:** [June 26, 2018, 8:08am UTC](https://forum.ansible.com/t/ansible-local-tmp-too-many-empty-directories/27872 "2018-06-26T08:08:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JFH](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@JFH](https://forum.ansible.com/u/JFH)\
**Post date:** [June 26, 2018, 8:08am UTC](https://forum.ansible.com/t/ansible-local-tmp-too-many-empty-directories/27872/1 "2018-06-26T08:08:31Z")

</div>

Hi,

We have a project with a lot of hosts (~75) and we have an issue with tmp local directories.  
We launch playbook with a crontab and after each run ansible didn’t remove tmp local directories.

TMP local directory example: ~/.ansible/tmp/ansible-local-8723VsP5KJ

So my question is, there is a configuration or a solution to force ansible remove tmp local directory?

For the moment, my workaround is:

`

- name: Ansible TMP directories autocleaner  
shell: “find {{ lookup(‘config’, ‘DEFAULT\_LOCAL\_TMP’) }}/…/ -mindepth 1 -maxdepth 1 -type d -ctime +2 | xargs rm -rf”  
changed\_when: false  
`

Thank you for your help.

Regards,

---

<div class="post-metadata">

**Author:** ![JFH](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@JFH](https://forum.ansible.com/u/JFH)\
**Post date:** [June 26, 2018, 8:10am UTC](https://forum.ansible.com/t/ansible-local-tmp-too-many-empty-directories/27872/2 "2018-06-26T08:10:53Z")

</div>

For your information, we have this issue with Ansible 2.4 and 2.5.

My ansible.cfg:

`  
[defaults]  
log\_path = ./logs/ansible.log  
roles\_path = /etc/ansible/roles/:roles/  
jinja2\_extensions = jinja2.ext.do,jinja2.ext.i18n

host\_key\_checking = false  
display\_skipped\_hosts = false  
retry\_files\_enabled = false  
deprecation\_warnings = false

forks = 5  
retry\_files\_enabled = false

[connection]  
pipelining = true

[ssh\_connection]  
pipelining = true  
control\_path = %(directory)s/ansible-ssh-%%h-%%p-%%r  
`
