Skip to main content

Cleaning up Ansible Temp Folders

As Ansible playbooks run, some will fail to cleanup temp folders on the Ansible server.

Since the temp folder for most Ansible jobs is configured as '/home/glwhite/Desktop', this will cause an accumulation of folders in that user's Desktop.

The folders are named with a unix timestamp.
So, the following command will delete them:

find ~/Desktop -maxdepth 1 -type d -name '[0-9]*' -exec rm -r {} +

You can preview the list of files to delete with this:

find ~/Desktop -maxdepth 1 -type d -name '[0-9]*'