Skip to content

Instantly share code, notes, and snippets.

@it-pappa
Last active May 1, 2023 11:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save it-pappa/f5c035cf50345d716f601c05f97dfc77 to your computer and use it in GitHub Desktop.
Save it-pappa/f5c035cf50345d716f601c05f97dfc77 to your computer and use it in GitHub Desktop.
Upgrade Ansible version in AWX

Upgrade Ansible version in AWX to latest Ansible devel

AWX 17 comes shipped with Ansible version 2.9.2*, but if you want to upgrade the Ansible version it can be some hassle. Here is how to upgrade the Ansible version for AWX :)

Note: the upgrade has to happen in the docker containers!

Login and run bash commands on the web container:

$ docker exec -it awx_web bash

Add new mirrorlist so you can install epel-release:

$ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
$ sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

Update, install epel-release, upgrad pip:

$ dnf update -y
$ dnf install epel-release
$ pip install --upgrade pip

Create a new virtual environment for awx and install depend's. (name the virtual environment what you want, in this example its named "ansible":

$ virtualenv /var/lib/awx/venv/ansible 
$ yum install -y gcc
$ yum install -y python-devel

Now we need to install some utils in the newly created virtual environment:

$ /var/lib/awx/venv/ansible/bin/pip install python-memcached psutil

Then install ansible in the new virtual environment:

$ /var/lib/awx/venv/ansible/bin/pip install -U ansible

Note: If you want to install an version of ansible, change ansible with "ansible == 2.9.28"

If you get an error that ansible is allready installed, uninstall it with:

$ /var/lib/awx/venv/ansible/bin/pip uninstall -U "ansible == version"

Exit the container:

$ exit

Now do the same steps on the task container:

$ docker exec -it awx_task bash

etc....

Make awx use our new virtual environment: Change the marked parts to fit your deployment

$ curl  -u 'admin:password' -X PATCH -H 'Content-Type: application/json' http://awx-ip/api/v2/organizations/org-name/ -d '

or in the web gui: url: http://awx-ip/api/v2/organizations/ Find the line: "custom_virtualenv":"" and add the new directory. Example: "custom_virtualenv":"/var/lib/awx/venv/ansible/"


Resources, links and thanks:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment