Short project to know how to create a basic AWX Execution Environment custom image based on Centos:stream10. In this example :
- requirements.txt will be used to install
requestspython module
- requirements.yml will be used to install
community.general,kubernetes.core, andgoogle.cloudcollections
- bindep.txt will be used to install some well known 'OS' packages (such as python!)
Project has been tested & validated with
- ansible-builder 3.1.1
- Nerdctl version 1.7.6
- It has to have access to https://quay.io/repository/ansible/awx-ee?tab=tags&tag=latest in order to use the base EE from RedHat quay.io.
- It has to have access to a private registry to push/pull images (i.e. setup a private Docker registry on your own or use GitHub/GitLab container registry, Sonatype Nexus etc...).
- Packages
ansible-builderanddockermust be installed.
- You have to know :
- which ansible collections you need.
- which python lib you need.
- which CentOS 'OS packages' you need.
Note: ansible-core & ansible-runner version aren't specified so they will use the latest available. If needed you can change that in execution-environment.yml.
- Add ansible collections you need into
requirements.yml. - Add python libraries you need into
requirements.txt. - If needed, you can add some 'OS' packages into
bindep.txt. - If needed, you can set some append/prepend instructions in
execution-environment.ymlor change base_image name to use a different CentOS image for instance. - Run the following command (-v is verbose level, -t is to tag your image and --container-runtime allow to use docker instead of podman as container engine). X.Y.Z is image tagging if you're using such a system. If not, you can replace it and tag it with latest.
ansible-builder build -v3 -t your-registry.com/path-to-image/your-image-name:X.Y.Z --container-runtime docker
Note: You can see your fresh docker image using
docker image ls
- Finally, login to your private registry and push your image using
docker push your-registry.com/path-to-image/your-image-name:X.Y.Z
Now you've successfully created a custom EE to pull from your AWX instance, congrats !😍
Ansible Execution Environment Definition https://ansible.readthedocs.io/projects/builder/en/stable/definition/#execution-environment-definition
Ansible Release Schedule https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#release-schedule