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

Docker-Verison-check-Ubuntu-20-04

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 -

Docker-Compose-Download-Ubuntu

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

Check-Docker-Compose-Version-Ubuntu

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

Ansible-Version-Check-Ubuntu

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 clone 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

Then clone the AWX source from the Github repository as shown

$ git clone --depth 50 https://github.com/ansible/awx.git

Git-Clone-ansible-awx-ubuntu

Navigate to the installer directory.

$ cd aws/installer

Using the pwgen command, generate a secret key

pwgen-generate-password-ubuntu

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=7rnNkbkpqo5H1gaqB6hTXnCaKnXuOo

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.

Ansible-playbook-inventory-awx-ubuntu

Step 8) Access AWX Dashboard

To access the dashboard, launch your browser and browse the server’s IP as shown

http://server-ip-address

Ansible-AWX-Dashboard-ubuntu

Provide your username and password and click on the ‘Sign In’ button. This will usher you to the dashboard shown below.

Ansible-AWX-Dashboard-Overview-Ubuntu

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

The post How to Install Ansible AWX on Ubuntu 20.04 LTS first appeared on LinuxTechi.

Leave a Comment