ansible-runner
"Consistent Ansible Python API and CLI with container and process isolation runtime capabilities"
What it is and what it does
Ansible Runner is a Python library and command-line tool that abstracts direct interaction with Ansible, letting you run playbooks and ad-hoc commands from Python code or shell scripts with a consistent, stable interface. It handles process isolation and can work with container runtimes, making it useful for embedding Ansible automation into larger systems without tight coupling to Ansible's internal APIs.
The package depends on pexpect for process interaction, python-daemon for background execution, pyyaml for configuration parsing, and packaging for version handling. It targets developers, system administrators, and IT teams who need to integrate Ansible automation into applications or orchestration workflows. The library is production-stable and actively maintained, supporting Python 3.9 through 3.12.
Use it for:
- Embed Ansible playbook execution into a Python application or REST API without direct Ansible API calls.
- Run infrastructure automation tasks from a CI/CD pipeline with isolated process execution and consistent status reporting.
- Build a custom orchestration layer that coordinates multiple Ansible runs with container or process boundaries.
- Automate system administration tasks from a Python script with structured output and error handling.
- Execute Ansible playbooks in a containerized environment as part of a larger automation platform.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Ansible Runner provides a Python library and CLI tool that wraps Ansible execution, offering a stable interface to run playbooks and ad-hoc commands with process and container isolation.
Yes. Ansible Runner is production-stable, actively maintained, and has low install friction. It solves a real problem—providing a clean Python interface to Ansible—and is well-suited for teams embedding Ansible into applications or orchestration systems. No known vulnerabilities. The permissive Apache 2.0 license poses no restriction.
Install
ansible-runner on PyPI
pip
pip install ansible-runneruv
uv add ansible-runnerpoetry
poetry add ansible-runnerInstalling ansible-runner
Before you install
Low install friction with five runtime dependencies (pexpect, packaging, python-daemon, pyyaml, importlib-metadata). Actively maintained as of 2026-08-14 with regular releases; repository shows 1081 stars and is not archived.
License in practice
Licensed under Apache Software License, Version 2.0 (permissive). No restrictions on commercial or private use; you may modify and distribute under the same license terms.
Quickstart
pip install ansible-runner
from ansible_runner import run
r = run(private_data_dir='/tmp/demo', playbook='site.yml')
print(r.status, r.rc)
Requires Python 3.9 or later; Ansible itself must be installed separately for playbook execution.
Verify before relying
- Whether the package handles Ansible version compatibility automatically or requires manual version management.
- Performance characteristics when running large playbooks or many concurrent tasks.
- Container runtime requirements and supported container backends beyond process isolation.
Package facts
| License | Apache Software License, Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — pexpect, packaging, python-daemon, pyyaml, importlib-metadata |
| Maintenance | actively maintained — 151 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,120,832/month — #2,745 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ansible_runner-2.4.3-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
ansible-builderAnsible Builder automates the creation of…
permissive · top 15,000 on PyPI
ansible-baseAnsible-base is the core automation engine for…
copyleft · top 15,000 on PyPI
pyinfrapyinfra executes Python code as infrastructure…
permissive · top 15,000 on PyPI
ansibleAnsible is an IT automation system that handles…
copyleft · top 5,000 on PyPI
ansible-coreAnsible Core is the engine for agentless IT…
copyleft · top 5,000 on PyPI
ansible-navigatoransible-navigator is a text-based user…
permissive · top 15,000 on PyPI
araARA Records Ansible records and reports on…
unclear · top 15,000 on PyPI
ansible-lintansible-lint checks Ansible playbooks and roles…
copyleft · top 5,000 on PyPI
ansible-dev-environmentCreates isolated virtual environments for…
copyleft · top 15,000 on PyPI
asv-runnerProvides core Python benchmark execution code…
permissive · top 15,000 on PyPI