Stop your Ansible temporary files from filling up /tmp on build agents

DevOps Tooling On Linux (CI/CD Runners, Ansible)

Stop your Ansible temporary files from filling up /tmp on build agents

Technical Briefing | 8/7/2026

You probably think your CI/CD runner is healthy because the build finished green, but the disk usage tells a different story. If you are running Ansible tasks against a fleet of nodes from a persistent runner, you might be surprised to find that /tmp is hemorrhaging inodes. Most people forget that every single Ansible task involving copy, template, or even just file state checks results in temporary files being dropped onto the target machine. If these don’t get cleaned up, your nodes eventually hit a wall.

Why Ansible acts like a hoarder

By default, Ansible writes module data to a hidden directory in the user’s home folder or the system temp path, then executes it. If a network blip occurs or the task aborts prematurely, those files stick around. I have seen disk space vanish on production web servers because a flaky playbook run left behind thousands of small script fragments. It is not just about disk space; it is about keeping your target systems clean of debris that can eventually interfere with permissions or logging.

ansible-playbook -e 'ansible_remote_tmp=/var/tmp/ansible' site.yml

  • Point your remote_tmp variable to a dedicated mount point if you have high churn
  • Set a cron job to purge files older than 24 hours in your chosen temp path
  • Check your runner configuration to ensure cleanup handlers are actually firing

The right approach is to be explicit about where those artifacts land so you can manage them with standard log rotation or cleanup utilities. Don’t let your configuration management tool treat your production servers like a scratchpad. If you check your nodes right now, you might find a graveyard of old Python wrappers waiting to be cleared out.

Linux Admin Automation  |  © www.ngelinux.com  |  8/7/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted