Site icon New Generation Enterprise Linux

Stop your Ansible execution environment from bleeding into your host

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

Stop your Ansible execution environment from bleeding into your host

Technical Briefing | 12/2/2026

I walked into a client site last month where they were running Ansible playbooks directly from the sysadmin’s laptop. Half the nodes were configured with Python 3.8 and the other half were catching up to 3.11. When someone updated their local system packages, the playbooks started failing because the local dependencies shifted under their feet. It is a classic trap: your automation tooling should be as immutable as the infrastructure you are managing.

Why shared system Python is a disaster waiting to happen

Using the system interpreter is just asking for a collision between your personal tools and your management scripts. If you use pip install to fix a dependency on your runner, you are effectively gambling with your production config. I have seen this blow up CI/CD runners when an automated OS update swaps out a shared library, rendering the entire deployment pipeline useless overnight.

python3 -m venv ~/ansible-env && source ~/ansible-env/bin/activate && pip install --upgrade pip && pip install ansible
  • Create a dedicated virtual environment for every major project iteration
  • Pin your Ansible versions in a requirements.txt file to keep the runner environment predictable
  • Use the ansible_python_interpreter variable to point at your controlled environment rather than /usr/bin/python

Isolate the runner from the host state

If you are running this in a CI environment like GitLab Runner or GitHub Actions, stop installing Ansible globally on the host. Put it in a container image or a strictly controlled runner path. By pinning the exact interpreter version, you stop the ‘it worked on my machine’ nonsense before it even starts. Keep your execution environment disposable and you will save yourself a dozen hours of debugging environment drift every single quarter.

Linux Admin Automation  |  © www.ngelinux.com  |  12/2/2026
0 0 votes
Article Rating
Exit mobile version