How to use proxy while creating Execution Environments in disconnected Ansible Automation Platform 2.x setup ?

Solution verified - Updated on

Request a new translation or translation update

A translation for your language preference does not exist. Click below to request a translation for your selected language.

Submit request

Environment

  • Red Hat® Ansible Automation Platform 2.x
  • ansible-builder

Issue

Resolution

  • Need to set the proxy in execution-environment.yml like below:

    • ansible-builder version 1
    ---
    version: 1
    additional_build_steps:
      prepend: |
        RUN export http_proxy=proxy.example.com
        RUN export HTTP_PROXY=proxy.example.com
        RUN export https_proxy=proxy.example.com
        RUN export HTTPS_PROXY=proxy.example.com
    
    • ansible-builder version 3
    ---
    version: 3
    additional_build_steps:
      prepend_base:
        - RUN pip3 config --global set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org"
        - RUN pip3 config --user set global.proxy "http://proxy.example.com"
      prepend_builder:
        - ENV http_proxy=proxy.example.com
        - ENV HTTP_PROXY=proxy.example.com
        - ENV https_proxy=proxy.example.com
        - ENV HTTPS_PROXY=proxy.example.com
    
    * To add http/s proxy permanently to the resulted image (not only during the image build) :
    
    additional_build_steps:
      append_final:
        - ENV http_proxy=proxy.example.com
        - ENV HTTP_PROXY=proxy.example.com
        - ENV https_proxy=proxy.example.com
        - ENV HTTPS_PROXY=proxy.example.com
    
    
  • Documentation for the additional_build_steps variable.

Root Cause

  • There was a known open issue about the customization limitations with Ansible Builder.

This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.