Ansible AWX is a free and opensource front-end web application that provides a user interface to manage Ansible playbooks and inventories, as well as a REST API for Ansible. It is an open source version of Red Hat Ansible Tower. In this guide, we are going to install Ansible AWX on Ubuntu 20.04 LTS system. We have previously penned down a guide on how to install Ansible AWX on CentOS 8.
Prerequisites
Before we get started, ensure that Ubuntu 20.04 system has the following:
- 4 GB of RAM
- 3.4 GHz CPU with 2 Cores
- Hard disk space 20 GB
- Internet Connection
Let’s jump into Ansible AWX installation steps
Step 1) Update package index
Log in to your Ubuntu system and update the package lists as shown
$ sudo apt update
Step 2) Install docker-ce (community edition)
Ansible AWX services will be deployed inside containers, and for that, we need to install docker and docker-compose to run multiple container images. There two main editions of Docker – Enterprise Edition (EE) & Docker Community Edition (CE).
The Community Edition is freely available, and this is what we are going to use for our installation.
So, first, import the Docker repository GPG key as shown.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Next, add the Docker Community Edition (CE) repository as shown
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu\ $(lsb_release -cs) stable"
Next, update the package lists and install Docker as shown:
$ sudo apt update $ sudo apt install -y docker-ce docker-ce-cli containerd.io
Once installed, add your local or regular user to the docker group so that regular user can run docker commands without the need for invoking the sudo command.
$ sudo usermod -aG docker $USER
Then restart the docker service.
$ sudo systemctl restart docker
Note: Do not forget to logout and login again, so that regular user can run docker commands without sudo.
Finally, you can confirm the docker version as shown
$ docker version
Step 3) Install docker-compose
Next in line, we are going to install docker-compose. So, download the latest docker-compose file as shown
$ curl -s https://api.github.com/repos/docker/compose/releases/latest \ | grep browser_download_url | grep docker-compose-Linux-x86_64 \ | cut -d '"' -f 4 | wget -qi -
Next, assign execute permissions to the docker-compose file as shown.
$ sudo chmod +x docker-compose-Linux-x86_64
Then move the docker-compose file to the /usr/local/bin path as shown.
$ sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
Finally, verify the version of docker-compose as shown.
$ docker-compose version
From the output, the docker-compose version is 1.28.5
Step 4) Install Ansible
Ansible is an open-source server automation and software provisioning tool that makes it possible to configure servers and deploy applications with ease. We are going to install Ansible which we shall later use to deploy AWX services.
Ansible is available on Ubuntu 20.04 repository, therefore use the APT command as shown.
$ sudo apt install -y ansible
Once the installation is completed, check the Ansible version as shown
$ ansible --version
Step 5) Install node and NPM (Node Package Manager)
Thereafter, install Node and NPM using the commands below
$ sudo apt install -y nodejs npm $ sudo npm install npm --global
Step 6) Install and Setup Ansible AWX
We are going to download the AWX installer from the Github repository. But let’s first install git, pip, and when (password generator)
$ sudo apt install -y python3-pip git pwgen
Next, install the docker-compose module that matches your version of docker-compose.
$ sudo pip3 install docker-compose==1.28.5
We are now going to download the latest AWX zip file from Github. To do so, we will use the wget command as follows.
$ wget https://github.com/ansible/awx/archive/17.1.0.zip
Once downloaded, unzip the file as shown.
$ unzip 17.1.0.zip
Once unzipped, be sure to locate the awx-17.1.0 folder in your directory. Next, navigate into the installer directory inside the awx-17.1.0 folder.
$ cd awx-17.1.0 /installer
Then generate a 30 character secret key using the pwgen tool as follows:
$ pwgen -N 1 -s 30
Copy this key and save it somewhere. Next, open the inventory file that is in the same directory.
$ vi inventory
Uncomment the admin and password parameters and be sure to provide a strong admin password. This is the password that you will use to log in to AWX on the web login page.
admin_user=admin admin_password=<Strong-Admin-password>
Additionally, update the secret key variable with the secret key generated earlier.
secret_key=lKjpI3Hdj2PWlp8De6g2pDj9e5dU5e
Step 7) Run the playbook file to Install AWX
Lastly, we are going to run the Ansible playbook file called install.yml as shown.
$ ansible-playbook -i inventory install.yml
This only takes a few minutes to complete.
Step 8) Access AWX Dashboard
To access the dashboard, launch your browser and browse the server’s IP as shown
http://server-ip-address
Provide your username and password and click on the ‘Log In’ button. This will usher you to the dashboard shown below.
And there you have it. We have successfully installed AWX on Ubuntu 20.04.
Also Read : How to Run and Schedule Ansible Playbook Using AWX GUI
Hey James
great post so far, i’m up to reviewing the installer process.
Interestingly there is no installer directory in the awx directory.
have cross checked with github and there is no installer directory there either.
any ideas?
“”Cheers
G
Hi Gerardo,
We have fixed the issue that you have mentioned. In place of cloning we have downloaded the AWX zip file from the github. Same steps have been updated in article too.
‘https://github.com/ansible/awx/blob/devel/CHANGELOG.md’
Saw some updates from 18 ver-Removed installer directory.
Hey Gerardo, I’m equally stunned to confirm your observation. It appears something changed with the AWX Github repository from the time this guide was published and now. That could be the only plausible explanation. At the time of writing this guide, everything was working as expected.
Thanks for post James, really useful to an AWX beginner like me. I did get stuck when trying to follow Pradeeps post on how to create projects, turns out i had to manually create the /var/lib/awx/projects folder and then uncomment ‘project_data_dir=/var/lib/awx/projects’ in the inventory file. Not sure if thats useful to anyone (i got stuck for a while).
Great post, thanx! Everyting installed, but there is a bug in awx 17.1 – ‘https://github.com/ansible/awx/issues/9043/’
It’s rather critical when use inventory from git. There is solution to use F12 in browser, but its painful 🙂
workaround:
i delete containers docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
and rerun step with git awx download, but use awx 15 version:
wget ‘https://github.com/ansible/awx/archive/15.0.0.zip’
edit inv and run, bug is gone.
Hi James,
Thanks a lot for the document it really helped me to launch the AWX UI. I tried a lot with minikube with 18.0 and faced lot many issues and finally got yours and saved time as well as me.
Thanks & Regards,
Durga cherukuri
I’m facing the below problem while running the install.yml file,
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in ‘/home/saurabh.pande/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml’: line 39, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
– name: Stop AWX before upgrading postgres
^ here
This issue got solved, It was because of the older version of ansible.
Hey guys, thank you very much for this guide.
It saved me alot of time, as I am a linux/ansible/awx beginner.
I was able to get this running with AWX version 17.0.1 (as described in the post).
Then I tried to use the current version (19.0.0) and as others already stated, there is no installer folder.
Does anyone know how to use this guide with newer versions of AWX?
Thanks very much for any hint on this!
From version 18.x, AWX uses kubernetes/minikube and not docker, so the install procedure is totally different.
I have hopes that someone might make a howto for setting up awx in a kubernetes cluster, as the cluster is pretty easy to get up and running.
Hi Jannis,
I would be writing a procedure on how to install Ansible AWX 18.x or higher on Minikube soon.
Thanks James for this nice document.
In this version ‘17.1.0’, I am not able to see the filter option in jog logs output on the dashboard. Is it not part of this version, any idea?
Help! Followed the steps and I got stuck on Step 7.
It seemed my instance got hung up. I tried running another ssh session of the instance it does not connect.
These are the last parts.
TASK [local_docker : Run migrations in task container] *************************
^[[A^[[A^[[A^[[A
********
changed: [localhost]
********
changed: [localhost]
********
changed: [localhost]
It seems not moving anymore.
Hi Janus,
Is your system have enough resources to run AWX ? By looking at the logs that you have shared is not giving any hint.
Hello,
This worked great, minus a few hiccups.
Important notes: If you do not have unzip, you will need to install it – ‘ apt install unzip’. Also before running the inventory playbook, make sure the directory path exists – /var/lib/awx/projects (which is the default path). For some reason, it did not create this path automatically.
Thanks for this tutorial!
Many thanks for this great effort! The only problem I had was after stopping nginx, there was no more failure. I was then able to access the AWX website.
Hello Everyone, Can someone guide me how add route to access the Ansible clients from the AWX server? Thanks in advance.
Thanks,
Sunil.K
Docker Compose Install did not work for me because the 2nd grep failed due to “Linux” being lowercase “l”. Once I changed it to lowercase, the step passed.
The step: $ curl -s ‘https://api.github.com/repos/docker/compose/releases/latest’ \
| grep browser_download_url | grep docker-compose-Linux-x86_64 \
| cut -d ‘”‘ -f 4 | wget -qi –
Just wanted to confirm if there is bug in this version . I have installed awx using container and version is 17.1.0.
Many of the things are performing in weird way or sometimes not even giving output or error
Actual script:
sudo apt install curl git python3-pip pwgen
curl -sSL ‘https://get.docker.com’ | sh
sudo usermod -aG docker $(whoami) && exit
sudo apt install docker-compose nodejs npm ansible -y
docker-compose version
sudo npm install npm –global
git clone -b 17.1.0 ‘https://github.com/ansible/awx.git’
cd awx/installer
pwgen -N 1 -s 30
nano inventory
ansible-playbook -i inventory install.yml