ERROR - Missing Ansible or Ansible Runner for selected Python

Hola buenos días, espero que estén bien todos!

Tengo este error al momento de crear una imagen nueva a partir de una base supported rhel9 (recién descargada). El caso es simple, agregar las collection redhat.satellite y redhat.insights en su última versión (ya que la imagen base no cuenta con las últimas.

El archivo de configuración ansible.cfg tiene los repositorios de un lab local de AAP en 2.5 donde tengo los repos actualizados y con las collections disponible.

Mi archivo de EE:

---
version: 3

images:
  base_image:
    name: registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel9:latest

options:
  package_manager_path: /usr/bin/microdnf

build_arg_defaults:
  ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre --ignore-certs'
  ANSIBLE_GALAXY_CLI_ROLE_OPTS: '--ignore-certs'

dependencies:
  system:
    - gcc
    - systemd-devel
    - python3.11-devel
  python_interpreter:
    package_system: python311
    python_path: /usr/bin/python3.11
  galaxy:
    collections:
      - name: redhat.satellite
        version: 5.11.0
      - name: redhat.insights
        version: 1.3.1

additional_build_files:
  - src: ansible.cfg
    dest: configs/

additional_build_steps:
  prepend_galaxy:
    - COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg
  append_final:
    - COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg

Y tengo este error:

...showing last 20 lines of output...
ERROR - Missing Ansible or Ansible Runner for selected Python

  An Ansible and/or Ansible Runner installation cannot be found in
  the final builder image using the following Python interpreter:

    /usr/bin/python3.11

  Ansible and Ansible Runner must be installed in the final image and
  available to the selected Python interpreter. If you are using a
  recent enough version of the execution environment file, you may use
  the 'dependencies.ansible_core' configuration option to install
  Ansible and the 'dependencies.ansible_runner' configuration option
  to install Ansible Runner. You can also use 'additional_build_steps'
  to manually do this yourself. Alternatively, use a base image with
  Ansible and Ansible Runner already installed.
**********************************************************************
+ exit 1
[2/4] STEP 1/15: FROM b262ffc2585a9d4e907529960fcbedd9069451190808469bd75307d2dafbb512 AS galaxy
[2/4] STEP 2/15: ARG EE_BASE_IMAGE
Error: building at STEP "RUN /output/scripts/check_ansible $PYCMD": while running runtime: exit status 1

El problema es que la imagen que estás utilizando usa python3.12 por defecto, y ansible y ansible-runner ya están instalados en esa versión.

Tendrás que actualizar tus dependencias para utilizar python3.12 en su lugar:

dependencies:
  system:
    - gcc
    - systemd-devel
    - python3.12-devel
  python_interpreter:
    package_system: python312
    python_path: /usr/bin/python3.12
1 Like

Excelente, gracias por el dato!!

machine@dvbcontentb satellite]$ ansible-builder build -t ee-supported-rhel9-custom:1.0
Running command:
  podman build -f context/Containerfile -t ee-supported-rhel9-custom:1.0 context
Complete! The build context can be found at: /home/machine/custum-ee/testing/satellite/context