Search code examples
dockeransiblevmwareansible-awxansible-collections

How To Upgrade ansible Collection In AWX Container?


I use AWX 17.0.1 Service On docker,

I Want to use ansible collection community.vmware. and i need recent release version collection.

So I did install community.vmware collection in awx_task container, but AWX is still use old version community.vmware collection. This collection is builtin collection in awx Container image.

When excute playbook, AWX is print like this.

[AWX template execute output] Using module file /usr/lib/python3.6/site-packages/ansible/modules/cloud/vmware/vmware_guest.py

that module is old version module.

how can i upgrade the python3.6 module??

I try to install recent release collection,

but AWX is not used that

AWX is still used old collection or python module


Solution

  • You can do that using Execution Environments in AWX

    enter image description here

    1. Create a Dockerfile from awx-ee image containing the collections:

        FROM quay.io/ansible/awx-ee:latest
        
        RUN ansible-galaxy collection install gluster.gluster \
         && ansible-galaxy collection install community.general
    

    Build the Image: docker build -t $ImageName .
    Log in to your Docker repository: docker login -u $DockerHubUser
    Tag the image: docker image tag $ImageName $DockerHubUser/$ImageName:latest
    Push the image to Hub: docker image push $DockerHubUser/$ImageName:latest

    2. Add Execution Environment to AWX:
    The image location, including the container registry, image name, and version tag EE
    3. That's it:

    enter image description here enter image description here I've tested that already on a fresh AWX instance, where there is no collections installed.

    You don't have to refer to the collection in a requirements.yml file

    Whenever a new Galaxy Collection is needed, it should be added to the Dockerfile and pushed to Hub.

    You can even install normal Linux packages in the docker image if needed.