Ansible Pilot

Run an Ansible Execution Environment - ansible-runner command-line tool

How to run a playbook (“ping.yml”) using a custom “my_ee” Ansible Execution Environment using the ansible-runner command-line tool.

September 18, 2022
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

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. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible Execution Environment

Let’s talk about the Ansible Execution Environment. The Ansible Execution Environment is container images that can be utilized as Ansible control nodes. It’s the latest technology developed by Red Hat to simplify the automation process. The main advantage is a familiar environment for Development and Production images using container technology creating portable automation runtimes. This technology superseded manual Python Virtual Environments, Ansible module dependencies, and bubblewrap. Experienced users are probably familiar with many challenges managing custom Python Virtual Environments and Ansible module dependencies. Enterprise users of Ansible Automation Platform were familiar with limiting execution jobs under bubblewrap in order to isolate processes The creation is performed by the Ansible Builder tool. Ansible Builder produces a directory that acts as the build context for the container image build, containing the 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.

The Best Resources For Ansible

Video Course

Printed Book



How to Run an Ansible Execution Environment using ansible-runner tool. I’m going to show you how to Run the custom “my_ee” Ansible Execution Environment using the ansible-runner tool.


localhost ansible_connection=local
- name: ping module demo
  hosts: all
  become: false
    - name: test connection


[[email protected] ee]$ ansible-runner run -p ping.yml --inventory inventory --container-image=my_ee .
PLAY [ping module demo] ********************************************************
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   
[[email protected] ee]$

When the ansible-runner tool is not installed you should install it via the DNF command using the ansible Automation Platform subscription:

[[email protected] ee]# dnf install ansible-runner


Now you know how to Run an Ansible Execution Environment using the ansible-runner command-line tool.

Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack to not miss the next episode of the Ansible Pilot.


Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and aws System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases

FREE Top 10 Best Practices

Top 10 Best Practices of Ansible Automation: save time, reduce errors and stress