leesangwoo
leesangwoo

Reputation: 55

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

Upvotes: 1

Views: 1325

Answers (2)

Khaled
Khaled

Reputation: 838

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.

Upvotes: 0

motorbass
motorbass

Reputation: 226

Better option as as advised should be to upgrade AWX (and get galaxy collection and python updates at the same time).

Now, your current AWX may use Control Plane Execution Environment (aka your server or K8s "layer" as you seems to get old AWX version) or AWX EE which is a docker image regularly up-to-date on quay.io

I advise to create a custom AWX EE where you can set your Ansible Galaxy collection requirements (within requirements.yml) and Python/Pip requirements (within requirements.txt). In order to do that, depends if you run on a server (as you got old AWX version) or K8s, you may need a private registry for Docker image hosting.

Here's some great tutorials :

Upvotes: 0

Related Questions