Chapter 4. Publishing an automation execution environment
4.1. Customizing an existing automation execution environments image
Ansible Controller includes the following default execution environments:
-
Minimal
- Includes the latest Ansible-core 2.15 release along with Ansible Runner, but does not include collections or other content -
EE Supported
- Minimal, plus all Red Hat-supported collections and dependencies
While these environments cover many automation use cases, you can add additional items to customize these containers for your specific needs. The following procedure adds the kubernetes.core
collection to the ee-minimal
default image:
Procedure
Log in to
registry.redhat.io
via Podman:podman login -u="[username]" -p="[token/hash]" registry.redhat.io
$ podman login -u="[username]" -p="[token/hash]" registry.redhat.io
Copy to Clipboard Copied! Ensure that you can pull the required automation execution environment base image:
podman pull registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest
podman pull registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest
Copy to Clipboard Copied! Configure your Ansible Builder files to specify the required base image and any additional content to add to the new execution environment image.
For example, to add the Kubernetes Core Collection from Galaxy to the image, use the Galaxy entry:
collections: - kubernetes.core
collections: - kubernetes.core
Copy to Clipboard Copied! - For more information about definition files and their content, see the definition file breakdown section.
In the execution environment definition file, specify the original
ee-minimal
container’s URL and tag in theEE_BASE_IMAGE
field. In doing so, your finalexecution-environment.yml
file will look like the following:Example 4.1. A customized
execution-environment.yml
fileversion: 3 images: base_image: 'registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest' dependencies: galaxy: collections: - kubernetes.core
version: 3 images: base_image: 'registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest' dependencies: galaxy: collections: - kubernetes.core
Copy to Clipboard Copied! NoteSince this example uses the community version of
kubernetes.core
and not a certified collection from automation hub, we do not need to create anansible.cfg
file or reference that in our definition file.Build the new execution environment image by using the following command:
ansible-builder build -t [username]/new-ee
$ ansible-builder build -t [username]/new-ee
Copy to Clipboard Copied! where
[username]
specifies your username, andnew-ee
specifies the name of your new container image.NoteIf you do not use
-t
withbuild
, an image calledansible-execution-env
is created and loaded into the local container registry.Use the
podman images
command to confirm that your new container image is in that list:Example 4.2. Output of a
podman images
command with the imagenew-ee
REPOSITORY TAG IMAGE ID CREATED SIZE localhost/new-ee latest f5509587efbb 3 minutes ago 769 MB
REPOSITORY TAG IMAGE ID CREATED SIZE localhost/new-ee latest f5509587efbb 3 minutes ago 769 MB
Copy to Clipboard Copied!
Verify that the collection is installed:
podman run [username]/new-ee ansible-doc -l kubernetes.core
$ podman run [username]/new-ee ansible-doc -l kubernetes.core
Copy to Clipboard Copied! Tag the image for use in your automation hub:
podman tag [username]/new-ee [automation-hub-IP-address]/[username]/new-ee
$ podman tag [username]/new-ee [automation-hub-IP-address]/[username]/new-ee
Copy to Clipboard Copied! Log in to your automation hub using Podman:
NoteYou must have
admin
or appropriate container repository permissions for automation hub to push a container. For more information, see the Manage containers in private automation hub section in Managing content in automation hub.podman login -u="[username]" -p="[token/hash]" [automation-hub-IP-address]
$ podman login -u="[username]" -p="[token/hash]" [automation-hub-IP-address]
Copy to Clipboard Copied! Push your image to the container registry in automation hub:
podman push [automation-hub-IP-address]/[username]/new-ee
$ podman push [automation-hub-IP-address]/[username]/new-ee
Copy to Clipboard Copied! Pull your new image into your automation controller instance:
- Go to automation controller.
-
From the navigation panel, select
. - Click .
Enter the appropriate information then click
to pull in the new image.NoteIf your instance of automation hub is password or token protected, ensure that you have the appropriate container registry credential set up.