Ansible LOCAL_TMP too many empty directories

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,

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
`