skillfed

ansible-runner

"Consistent Ansible Python API and CLI with container and process isolation runtime capabilities"

ansible-runner v2.4.3 3.1M downloads/30d#2,745 on PyPI1,081
Permissive license Apache Software License, Version 2.0 Active released

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-runner

uv

uv add ansible-runner

poetry

poetry add ansible-runner

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: POSIXProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Systems AdministrationTopic :: Utilities

Tags

ansible execution wrapperrun ansible playbooks programmaticallyansible python apiansible process isolationansible container interfaceansible cli abstractionansible automation framework
infrastructure-automationansible-integrationprocess-isolation

More Python Modules packages