This repository contains Ansible automation to build custom Execution Environments (EEs) for use with Ansible Automation Platform (or ansible-navigator). It uses ansible-builder to assemble the EEs based on definition files and pushes them to a container registry.
Before you begin, ensure you have the following tools installed on your system:
ansible-coreansible-builderpodman(or another compatible container engine)ansible-vault
You will also need one or more Ansible collections:
ansible-galaxy collection install -r collections/requirements.ymlThis project uses Ansible Vault to manage sensitive registry credentials.
-
Create the Vault File: Create a file named
.vault.ymlin the root of the repository with the following content:--- # Credentials for the source registry (e.g., registry.redhat.io) registry_name: "registry.redhat.io" registry_user: "" # Your Red Hat username/service account registry_pass: "" # Your Red Hat password/service account token registry_token: "" # Your Red Hat Offline Token for Ansible Galaxy # Credentials for the destination registry (e.g., quay.io) dest_registry_name: "quay.io" dest_registry_user: "" # Your destination registry username dest_registry_pass: "" # Your destination registry password/token
-
Create a Vault Password File: The
ansible.cfgin this repository is configured to use a vault password file named.vault_pass.txt. Create this file and add your vault password to it.echo "your_super_secret_vault_password" > .vault_pass.txt
-
Encrypt the Vault File: Encrypt the
.vault.ymlfile usingansible-vault.ansible-vault encrypt .vault.yml --vault-password-file .vault_pass.txt
To build an EE, run the build_ee.yml playbook and specify which EE definition file you want to use with the ee_vars_file extra variable.
Example:
To build the ee-casc-rhel9 environment for Ansible Automation Platform 2.6, run the following command:
ansible-playbook build_ee.yml --extra-vars "ee_vars_file=vars/ansible-automation-platform-26/ee-casc-rhel9.yml"The playbook will build the container image and push it to the destination registry specified in your .vault.yml file (e.g., quay.io/lshirley/ansible-automation-platform-26/ee-casc-rhel9).
The definitions for the execution environments are located in the vars/ directory.
| Name | Purpose | Notes | Ansible Core | OS | Var File | Public Repo |
|---|---|---|---|---|---|---|
ansible-automation-platform-24/ee-casc-rhel8-git |
Config as Code for AAP 2.4 | Collections pulled from Public Git Repos | 2.16.x | RHEL 8 | Link | Link |
ansible-automation-platform-24/ee-casc-rhel8 |
Config as Code for AAP 2.4 | Collections pulled from RH Console | 2.16.x | RHEL 8 | Link | Link |
ansible-automation-platform-24/ee-casc-rhel9-git |
Config as Code for AAP 2.4 | Collections pulled from Public Git Repos | 2.16.x | RHEL 9 | Link | Link |
ansible-automation-platform-24/ee-casc-rhel9 |
Config as Code for AAP 2.4 | Collections pulled from RH Console | 2.16.x | RHEL 9 | Link | Link |
ansible-automation-platform-25/ee-casc-rhel8-git |
Config as Code for AAP 2.5 | Collections pulled from Public Git Repos | 2.16.x | RHEL 8 | Link | Link |
ansible-automation-platform-25/ee-casc-rhel8 |
Config as Code for AAP 2.5 | Collections pulled from RH Console | 2.16.x | RHEL 8 | Link | Link |
ansible-automation-platform-25/ee-casc-rhel9-git |
Config as Code for AAP 2.5 | Collections pulled from Public Git Repos | 2.16.x | RHEL 9 | Link | Link |
ansible-automation-platform-25/ee-casc-rhel9 |
Config as Code for AAP 2.5 | Collections pulled from RH Console | 2.16.x | RHEL 9 | Link | Link |
ansible-automation-platform-26/ee-casc-rhel9-git |
Config as Code for AAP 2.6 | Collections pulled from Public Git Repos | 2.16.x | RHEL 9 | Link | Link |
ansible-automation-platform-26/ee-casc-rhel9 |
Config as Code for AAP 2.6 | Collections pulled from RH Console | 2.16.x | RHEL 9 | Link | Link |
ee-proxmox-rhel9 |
Dynamic Proxmox Inventory | 2.17.x | RHEL 9 | Link | Link | |
ee-unifi-rhel9 |
Dynamic UniFi Inventory | 2.17.x | RHEL 9 | Link | Link | |
ee-xorriso-rhel9 |
Building ISO's | 2.15.x | RHEL 9 | Link | Link |
- The
build_ee.ymlplaybook is the main entry point. - It includes the variable file specified by
ee_vars_fileto get the specific EE definition. - It calls the
build_eerole. - The role creates a
_builddirectory and templates out the necessary files foransible-builder, includingexecution-environment.yml,requirements.txt, etc. - It runs the
ansible-builder buildcommand to create the container image. - Finally, it tags the new image with
latestand a timestamp, and pushes both tags to the destination registry.
- My
build_eerole is a tweaked version I got from Alex Dworjan's repo here. Please be sure to give him a shout out!
This project is licensed under the MIT License. See the LICENSE file for details.