Run an Ansible Execution Environment - ansible-runner command-line tool
By Luca Berton · Published 2024-01-01 · Category: installation
How to run a playbook (“ping.yml”) using a custom “my_ee” Ansible Execution Environment using the ansible-runner command-line tool.

How to run a custom Ansible Execution Environment?
Using an Ansible Execution Environment is the latest technology to maintain up-to-date Python dependency of the Ansible collections without interfering with your Linux system. It's the evolution of Python Virtual Environment. This initial configuration sometimes is a roadblock for some Ansible users.See also: Build a Custom Ansible Execution Environment Easily
Ansible Execution Environment
- Ansible Execution Environment
ansible-builderansible-runner
Containerfile, along with any other files that need to be added to the image.
On the other end, the Ansible Runner tool performs the execution.
The Ansible Runner enables you to run the Execution Environment as a container in the current machine. It is basically taking care that the content runs as expected.
Links
- https://www.redhat.com/en/technologies/management/ansibleproducts/execution-environments
- https://docs.ansible.com/automation-controller/latest/html/userguide/execution_environments.html
See also: Build & Run Ansible Execution Environments Effectively
Playbook
How to Run an Ansible Execution Environment using ansible-runner tool.
code
- inventory
localhost ansible_connection=local- ping.yml
---
- name: ping module Playbook
hosts: all
become: false
tasks:
- name: test connection
ansible.builtin.ping:execution
[devops@demo ee]$ ansible-runner run -p ping.yml --inventory inventory --container-image=my_ee .
PLAY [ping module Playbook] ********************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [test connection] *********************************************************
ok: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[devops@demo ee]$When the ansible-runner tool is not installed you should install it via the DNF command using the ansible Automation Platform subscription:
[root@demo ee]# dnf install ansible-runnerConclusion
Now you know how to Run an Ansible Execution Environment using the ansible-runner command-line tool.
See also: Ansible Builder & Execution Environments: Complete Guide (2026)
Related Articles
Category: installation
Watch the video: Run an Ansible Execution Environment - ansible-runner command-line tool — Video Tutorial