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

Solution Verified - Updated -

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
      **Note: prepend_base is optional. If a proxy server exists between your ansible-builder server and your offline pypi server, this settings might be needed. For further information regarding ansible-builder in an offline environment, refer to How to run ansible-builder in an offline environment..
    ---
    version: 3
    additional_build_steps:
      prepend_base:
        - RUN pip3 config set --global global.trusted-host \"pypi.org files.pythonhosted.org pypi.python.org\"
      prepend_builder:
        - ENV export http_proxy=proxy.example.com
        - ENV export HTTP_PROXY=proxy.example.com
        - ENV export https_proxy=proxy.example.com
        - ENV export 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.

Comments