Build & Run Ansible Execution Environments Effectively — Video Tutorial
Discover how to build and run Ansible Execution Environments using ansible-builder and ansible-runner tools. Simplify your automation setup with container technology.
Watch Video
Watch "Build & Run Ansible Execution Environments Effectively" on YouTube
What You'll Learn
- How to build and Run an Ansible Execution Environment?
- Ansible Execution Environment
- Links
- Playbook
- Demo Build Ansible Execution Environment
- code
- execution
- Demo Run Ansible Execution Environment
- code
- execution
Full Tutorial Content
How to build and Run an 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
- `ansible-builder`
- `ansible-runner`
Let's talk about the Ansible Execution Environment.
The Ansible Execution Environment is a container image 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 common 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 a lot of challenges managing custom Python Virtual Environments and Ansible module dependencies. Enterprise users of Ansible Automation Platform were familiar limited to executing 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.
The execution is performed by the Ansible Runner tool.
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.ansible.com/products/execution-environments
- https://www.redhat.com/en/technologies/management/ansible/automation-execution-environments
- https://docs.ansible.com/automation-controller/latest/html/userguide/execution_environments.html
Playbook
How to Build and Run a custom-built "my_ee" Ansible Execution Environment using ansible-builder and ansible-runner tools.
Demo Build Ansible Execution Environment
How to Build an Ansible Execution Environment using the `ansible-builder` tool.
- name: my_ee
- System (git)
- Python (boto3)
- Collection (community.aws)
How to Build an Ansible Execution Environment using ansible-builder tool.
I'm going to show you how to Build a custom "my_ee" Ansible Execution Environment using the ansible-builder tool specifying some custom System, Python, and collection dependency.
For example, let's build a custom Ansible Execution Environment named "my_ee" with System requirements `git`, Python libraries `boto3` and Amazon Collection `community.aws` dependencies.
code
- execution-environment.yml
```yaml
---
version: 1
dependencies:
galaxy: requirements.yml
python: requirements.txt
system: bindep.txt
additional_build_steps:
prepend: |
RUN pip3 install --upgrade pip setuptools
a
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 4 min
- Category: installation
Read the full written article: Build & Run Ansible Execution Environments Effectively
Topics Covered
Related Video Tutorials
- Build a Custom Ansible Execution Environment Easily — Learn how to build a custom Ansible Execution Environment using the ansible-builder tool. Manage system, Python, and collection dependencies effectively.
- 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.
- Install Docker in Debian-like systems - Ansible module apt_key, apt_repository and apt — How to automate the installation of the docker-ce engine in Ubuntu 20.04 LTS x86_64 (or amd64) using Ansible Playbook. The procedure is going to take care of the GPG signing key, add a repository into the sources list, and install the latest docker-ce package. Included Demo for Debian-like workstation (Debian and Ubuntu).
- Ansible Playbook for Installing Docker on Linux Systems — Learn how to install Docker on Linux systems using an Ansible playbook. Follow our guide for a seamless Docker setup and start process.
- Install Docker in Windows-like systems - Ansible module win_chocolatey — How to automate the installation of the latest version of Docker Desktop in your Windows-like system with Ansible Playbook and Chocolatey.
- Search for AWS EC2 AMI ID by Region - Ansible module ec2_ami_info — How to automate the search of an AWS EC2 machine AMI ID running the operating system RHEL-8.3.0 in the region "us-east-1" using Ansible Playbook and ec2_ami_info module.