Ansible AWX is an open-source web-based solution that makes Ansible much easier to use in IT environments. It provides a web-based user interface and task engine for easy and collaborative management of Ansible. In this tutorial, we are going to install Ansible AWX on Ubuntu 20.04 LTS system.
Ensure that your 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
Step 1 Update your Ubuntu System
Update your system packages to their latest versions. Run the command below:
$ sudo apt update
Step 2- Install docker-ce (community edition)
Ansible AWX services will be deployed as docker containers .We therefore need to install docker and docker-compose to run multiple container images. Docker consists of two editions – Enterprise Edition (EE) and Community Edition (CE).
The Community Edition is free, and this is what we are going to install.
First, import the Docker repository GPG key. Run:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Next, add the Docker Community Edition (CE) repository to your ubuntu system:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu\ $ (lsb_release -cs) stable"
Next, update packages and install Docker. Run the command:
$ sudo apt update
$ sudo apt install -y docker-ce docker-ce-cli containerd.io
Once the installation is complete, add your local or regular user to the docker group so that regular user can run docker commands as a non-root user.
Run the command:
$ sudo usermod -aG docker $USER
Then restart the docker service.
$ sudo systemctl restart docker
Run the command below or logout and login again, so that a regular user can run docker commands without sudo.
$ newgrp docker
Finally, confirm the version of docker that you have installed:
$ docker version
Step 3 Install docker-compose
Next, we are going to install docker-compose.
Download the docker-compose file by running:
$ 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, make the binary file executable by running:
$ sudo chmod +x docker-compose-Linux-x86_64
Next, move the docker-compose file to the /usr/local/bin path:.
$ sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
Finally, verify the version of docker-compose installed. Run:
$ docker-compose version
From the output below, the docker-compose version installed is 1.28.6
Step 4 Install Ansible
Ansible is an open-source automation tool for cross-platform computer support. It is used for IT tasks such as application deployment, configuration management, updates on workstations and servers, cloud provisioning etc.
We will later use Ansible to deploy AWX services.
Ansible is available on the official Ubuntu 20.04 repository. Run the command below to install the latest release:
$ sudo apt install -y ansible
To verify successful installation, check the Ansible version as shown:
$ ansible --version
Step 5 Install node and NPM (Node Package Manager)
Next,we install Node and NPM. Execute the commands below:
$ sudo apt install -y nodejs npm
$ sudo npm install npm --global
Step 6 Install and Setup Ansible AWX
You will need to install some extra packages git, pwgen and git. Run the command below to install the additional packages:
$ sudo apt install -y python3-pip git pwgen
Next, install the docker-compose module. It should match with your version of docker-compose.
$ sudo pip3 install docker-compose==1.28.6
Next , download the latest AWX zip file from Github. Run the wget command below:
$ wget https://github.com/ansible/awx/archive/17.1.0.zip
After the download is completed, unzip the file as shown.
$ unzip 17.1.0.zip
Make sure to locate the awx-17.1.0 folder in your directory. Then navigate into the installer directory inside the awx-17.1.0 folder as shown
$ cd awx-17.1.0 /installer
Next, generate a 30 character secret key using the pwgen tool as follows:
$ pwgen -N 1 -s 30
Copy the key and save it somewhere. Next, we open the inventory file which is in the same directory.
$ vim inventory
Next, set the admin password to something more secure. You will use this password to log into AWX.
Additionally, modify the secret key with the secret key generated earlier.
Step 7- Run the playbook file to Install AWX
In this step, we are going to run the Ansible playbook file called install.yml as shown below:
$ ansible-playbook -i inventory install.yml
This only takes a few minutes to complete.
Step 8 Access AWX Dashboard
Open your browser and browse to the server’s IP as shown below:
Login with the admin username and password that you set in the inventory file.
This will open the AWX dashboard as shown:
In this guide you learnt how to install Ansible AWX on Ubuntu 20.04.