How to Install Ansible AWX Tower on Ubuntu 20.04 Server (Tutorial)

How to Install Ansible AWX Tower on Ubuntu 20.04 Server (Tutorial). In this tutorial we will introduce Ansible AWS with it’s main features then move onto installation phase using Ansible, Docker and Docker Compose.

AWX is an open source project built on top of Ansible. It provides a web based control panel to manage Ansible playbooks, inventories, secrets, and scheduled jobs. It is very useful to test Ansible in local environment.

What Is Ansible AWX?

Ansible AWX is an open source freely available project used for testing. You can use it in any environment such as lab or development. It is considered the foundation of the Ansible Tower.

It is a development branch code that undergoes only required testing and quality engineering testing. Usually, enterprises find adoption difficult due to a lack of signed images being used, real visioning presented with upgrades and the support offered.

However, when IT teams use AWX, a web based solution of Ansible tool, their work becomes more comfortable. They consider it a hub for every automation task. It also constitutes Rest API, a browser that enables you o control access, graphically manage or sync inventory with several cloud sources, log all your jobs, and integrate with Lightweight Directory Access Protocol (LDAP) appropriately.

Benefits Of Ansible AWX

AWX is built with the purpose to run on top of the Ansible projects, thereby optimizing the already sturdy automation engine. With the help of Ansible AWX, you can enjoy the following benefits:

Delegate

With the help of AWX, you can create users and group them into a single team to whom you can further provide access and rules to inventory, credentials, and playbook at individual levels or team levels. This way, you can effortlessly set up push button access to complex automation and even control it (i.e., who can use it or when they can run it).

For instance, if you need to stand up a new environment, you don’t have to invest your time in adding another task to your already overbooked schedule. Rather, all you need to do is authorize your team to log into AWX and enable them to run provisioning on their own. AWX can also elicit parameters, providing sales and reasonable choices.

Schedule Workflow

Ansible AWX helps you build a job template by bringing credentials, playbooks and inventories together. This template represents a command line execution of the ansible playbook. You don’t have to touch the command line, though. It allows you to run your job template on demand and watch real time playbook output in your web browser. You can also schedule it to run later and acquire complete access to the output whenever required.

Additionally, for running a single playbook, you can effortlessly create a job template with the workflow editor that chains several playbook to run together.

Access Reporting

When you have users, you only require tools for tracking playbook runs and troubleshooting problems. With the help of AWX, you can add a custom callback plugin to Ansible Playbook run so that it captures events and outputs data in real time. You can attain a high level summary of the stored output through a dashboard. It also provides an overview of job execution, failures and success as well as a breakdown of inventory success and failure. This way, you will know the type of playback you want to run and learn about any trouble spots that require immediate attention.

At its playbook level, you will be able to access the results and outputs down to individual tasks on a specific host. Therefore, if your development team tried to create an environment that does not provide the way it is expected, you can immediately troubleshoot and correct the problem.

Automate Via API

As discussed above, AWX constitutes a sturdy restful API, which enables the user interface to communicate with the backend. It demonstrates its power and completeness. Anything you perform in the web browser is affected through API calls. And since it is fully browsable and self documenting, you can access the working of your IT organizations appropriately.

Follow this post to explain how to install the Ansible AWX tower on Ubuntu 20.04 server.

How to Install Ansible AWX Tower Ubuntu 20.04

Prerequisites

  • A root user or a user with sudo privileges.
  • Minimum 4 GB of RAM with 2 Cores CPU.

Install Docker Engine

Before starting, you will need to install the Docker CE on your server. By default, the latest version of Docker CE is not included in the Ubuntu default repository so you will need to add the Docker’s official repository on your server.

First, install the required dependencies using the following command:

				
					apt install software-properties-common curl gnupg2 wget -y
				
			

Next, download and add the Docker GPG key with the following command:

				
					curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
				
			

Next, add the Docker CE repository to APT using the following command:

				
					add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
				
			

Once the repository is added, update the repository cache and install the Docker CE using the following command:

				
					apt update -y
apt install docker-ce docker-ce-cli containerd.io -y
				
			

After the successful installation, start the Docker service and enable it to start at system reboot:

				
					systemctl start docker
systemctl enable docker
				
			

You can now verify the Docker service status using the following command:

				
					systemctl status docker
				
			

You will get the following output:

				
					● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-06-04 16:09:50 UTC; 17s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 3502 (dockerd)
Tasks: 8
Memory: 29.9M
CGroup: /system.slice/docker.service
└─3502 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.051305445Z" level=warning msg="Your kernel does not support CPU realtime >
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.051325000Z" level=warning msg="Your kernel does not support cgroup blkio >
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.051342675Z" level=warning msg="Your kernel does not support cgroup blkio >
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.052304928Z" level=info msg="Loading containers: start."
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.254521577Z" level=info msg="Default bridge (docker0) is assigned with an >
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.360563964Z" level=info msg="Loading containers: done."
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.398381608Z" level=info msg="Docker daemon" commit=f756502 graphdriver(s)=>
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.398582452Z" level=info msg="Daemon has completed initialization"
Jun 04 16:09:50 ubuntu2004 systemd[1]: Started Docker Application Container Engine.
Jun 04 16:09:50 ubuntu2004 dockerd[3502]: time="2022-06-04T16:09:50.449412402Z" level=info msg="API listen on /run/docker.sock"

				
			

Next step in how to Install Ansible AWX Tower on Ubuntu 20.04 Server is to install Docker.

Install Docker Compose

You will also need to install the Docker Compose to your server. By default, the Docker Compose is available in the Ubuntu default repository. You can install it using the following command:

				
					apt install docker-compose -y
				
			

Once the Docker Compose is installed, you can verify the installation using the following command:

				
					docker-compose version
				
			

You will get the following output:

				
					docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.10
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
				
			

Install Ansible and Other Dependency

You will also need to install the Ansible on your server. By default, the Ansible package is included in the Ubuntu default repository. You can install it using the following command:

				
					apt install ansible -y
				
			

Once the Ansible is installed, you can verify Ansible installation using the following command:

				
					ansible --version
				
			

You should see the following output:

				
					ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]

				
			

Install Node js

Next, install the Node.js and NPM package manager using the following command:

				
					apt install nodejs npm -y
npm install npm --global
				
			

Following that please install Python dependencies using the following command:

				
					apt install python3-pip git pwgen -y
				
			

Next, install the Docker Compose Python module using the following command:

				
					pip3 install docker-compose==1.25.0
				
			

Install Ansible AWS Tower

First, download the Ansible AWS from the Git repository using the following command:

				
					wget https://github.com/ansible/awx/archive/17.1.0.zip
				
			

Once the download is completed, unzip the downloaded file with the following command:

				
					unzip 17.1.0.zip
				
			

Next, change the directory to the extracted directory to the installer directory and generate the secrete key using the following command:

				
					cd awx-17.1.0/installer
pwgen -N 1 -s 30
				
			

You will get the following key:

				
					gBSBmZgb1CyuT6p6TZ4D0pF2oZMP4x
				
			

Please edit the inventory file with the following command:

				
					nano inventory
				
			

Define your admin user credentials and secrete key as shown below:

				
					admin_user=admin
admin_password=secureadminpassword
secret_key=gBSBmZgb1CyuT6p6TZ4D0pF2oZMP4x
				
			

Save and close the file when you are finished. Next, run the following to install the Ansible AWX Tower:

				
					ansible-playbook -i inventory install.yml
				
			

Once the Ansible Tower is installed. You can verify the running container using the following command:

				
					docker ps
				
			

You should see all running container in the following output:

				
					CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e210d7f15db ansible/awx:17.1.0 "/usr/bin/tini -- /u…" 46 seconds ago Up 43 seconds 8052/tcp awx_task
db01e784479f ansible/awx:17.1.0 "/usr/bin/tini -- /b…" 3 minutes ago Up 42 seconds 0.0.0.0:80->8052/tcp, :::80->8052/tcp awx_web
330cf7a6e81e postgres:12 "docker-entrypoint.s…" 3 minutes ago Up 42 seconds 5432/tcp awx_postgres
3f4ccefd5395 redis "docker-entrypoint.s…" 3 minutes ago Up 43 seconds 6379/tcp awx_redis

				
			

To see all downloaded Docker images, run the following command:

				
					docker images
				
			

You should see the following output:

				
					REPOSITORY TAG IMAGE ID CREATED SIZE
postgres 12 bc02a3fd9d66 7 days ago 373MB
redis latest 53aa81e8adfa 7 days ago 117MB
centos 8 5d0da3dc9764 8 months ago 231MB
ansible/awx 17.1.0 599918776cf2 15 months ago 1.41GB

				
			

We have followed the steps in How to Install Ansible AWX Tower on Ubuntu 20.04 Server and now it is time to access Ansible.

Access Ansible AWX Web Interface

1.Open your web browser and access the Ansible AWX web interface using the URL http://your-server-ip. You will be redirected to the Ansible AWX login page:

2.Provide your admin username, password, and click on the Log In button. You should see the Ansible AWX dashboard on the following page:

How to Install Ansible AWX Tower on Ubuntu 20.04 Server Conclusion

In this post, we have explained how to install Ansible AWX Tower on Ubuntu 20.04 server. Using Ansible for Network Automation is great to get started with programmability. AWX will allow you to schedule jobs and provide an audit path of previously run tasks. You can now explore Ansible AWX to automate your infrastructure.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x