4.3. Customizing an existing execution environment image


Ansible Controller ships with three default execution environments:

  • Ansible 2.9 - no collections are installed other than Controller modules
  • Minimal - contains the latest Ansible 2.11 release along with Ansible Runner, but contains no collections or other additional content
  • EE Supported - contains all Red Hat-supported content

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

  1. Log in to quay.io via Podman:

    $ podman login -u="[username]" -p="[token/hash]" quay.io
    Copy to Clipboard Toggle word wrap
  2. Verify that you have access to pull the base image that you want to use.

    1. For example, to pull a ee-minimal image, check that you have access to this repository.
  3. Configure your Ansible Builder files to specify any additional content to add to the new execution environment image which is based off of ee-minimal.

    1. For example, to add the Kubernetes Core Collection from Galaxy to the image, fill out the requirements.yml file as such:

      ---
      collections:
        - kubernetes.core
      Copy to Clipboard Toggle word wrap
    2. For more information on definition files and their content, refer to to definition file breakdown section.
  4. In the execution environment definition file, specify the filepath to the original ee-minimal container via the EE_BASE_IMAGE field. In doing so, your final execution-environment.yml file will look like the following:

    例 4.2. A customized execution-environment.yml file

    ---
    version: 1
    
    build_arg_defaults:
      EE_BASE_IMAGE: 'example.registry.com/my-base-ee'
    
    dependencies:
      galaxy: requirements.yml
    Copy to Clipboard Toggle word wrap
    注意

    Since this example uses the community version of kubernetes.core and not a certified collection from automation hub, we do not need to create an ansible.cfg nor reference that in our definition file.

  5. Build the new execution environment image using the following command:

    $ ansible-builder build -t quay.io/[username]/new-ee
    Copy to Clipboard Toggle word wrap

    where [username] specifies your username, and new-ee specifies the name of your new container image.

    1. Use the podman images command to confirm that your new container image is indeed in that list:

      例 4.3. Output of a podman images command with the image new-ee

      REPOSITORY          TAG     IMAGE ID      CREATED        SIZE
      localhost/new-ee    latest  f5509587efbb  3 minutes ago  769 MB
      Copy to Clipboard Toggle word wrap
  6. Verify your newly-created execution environment image via Ansible Navigator
  7. Push your image to the container registry automation hub:

    $ podman push quay.io/[username]/new-ee
    Copy to Clipboard Toggle word wrap
  8. Pull your new image in your automation controller instance:

    1. Navigate to automation controller
    2. From the side-navigational bar, click Administration > Execution Environments.
    3. Click Add.
    4. Enter the appropriate information then hit Save to pull in the new image.

      注意

      if your instance of automation hub is password or token protected, ensure that you have the appropriate container registry credential set up.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat