How to install AWX in Docker
[Note: This is a deprecated way of installing AWX. Nowadays Kubernetes is the recommended way. I switched to Kubernetes a while back. At the time I didn't have a Kubernetes cluster, so I followed this guide to get AWX up and running in a Kubernetes environment on a single machine. ]
AWX is the upstream open-source version of Ansible Tower which is free.
Latest repo: https://github.com/ansible/awx
Unlike Tower, there is no support from RedHat. If you want a supported version, consider buying Ansible Tower. Even if you plan to buy Ansible Tower, AWX is a fantastic way to "try before you buy". You might also realise you don't need to spend the dough to get what you want, depending on your needs.
Install AWX 17.0.1 in Docker on Ubuntu 20.04
We're going to be installing AWX 17.0.1 on an Ubuntu Desktop 20.04 running within VMWare workstation
Full install instructions can always be found here – https://github.com/ansible/awx/blob/devel/INSTALL.md
Starting from a clean Ubuntu 20.04 installation, start by updating the packages.
sudo apt update && sudo apt -y upgrade
sudo reboot
Install VMWare tools, net-tools, Git SSH and Virtualenv.
sudo apt install open-vm-tools-desktop
sudo apt install net-tools
sudo apt install git
sudo apt install python3-virtualenv
Setup Virtual Environment
Create a directory called virtual and then create a virtual environment within that directory called awx.
mkdir virtual
cd virtual
virtualenv awx
Activate the virtual environment.
source awx/bin/activate
Your prompt should now change to (awx) user@machine:~/virtual$
Install Docker
sudo apt -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
newgrp docker
Check Docker version.
docker version
Install Docker Compose
Then install docker-compose, in doing so it will also install Docker, which is another requirement.
pip3 install docker-compose
Clone the AWX repository from GitHub, make sure you go to your home directory before doing this otherwise you will get an error saying the folder awx already exists.
git clone -b 17.0.1 https://github.com/ansible/awx.git
Edit the Inventory file
You now have a folder called awx and within there a folder called installer and within there an inventory file you need to edit.
You just need to make sure you have set an admin password and we need to change the directory of your virtual environment.
Uncomment and change # admin_password=password to your password like so
admin_password=(your secure password)
Find the AWX custom virtual environment folder. Only usable for local install.
custom_venv_dir=/opt/my-envs/ and change the path to /home/joakimnordin/virtual/awx but make sure you change to your username, not my username obviously.
Install Ansible
To build AWX you need to have Ansible installed to run the install playbook, so make sure you are in your virtual environment and run
pip3 install ansible
Run the install Playbook
ansible-playbook -i inventory install.yml
If everything went well, it should now be working.
This will take a little while to run through as it must pull some images from Docker, but once it completes you should be able to type docker ps and see your running containers like so.
At this point you can to your servers IP and login: