How to install Ansible AWX 17.1.0 on Ubuntu 20.04

AWX is an open source community project sponsored by Red Hat. It serves as the development environment for the Ansible Tower. AWX is released frequently and includes all new developments.

Ansible AWX provides a web-based user interface for managing Ansible hosts, playbooks, modules, job scheduling, workflow automation, sharing credentials and tools to enable delegation.

In this tutorial, we’ll go through that installation Process of Ansible AWX At Ubuntu 04/20.

requirements

  • Root access or user with sudo permissions for the SSH connection.
  • Ubuntu 04/20 or 04/18
  • minimum 4 GB of RAM
  • minimum 2vcpus
  • minimum 20 GB free storage space

Ansible AWX must also be installed for successful commissioning:

  • Ansible
  • Compose Docker and Docker
  • Node and NPM

1. Install Ansible on Ubuntu 20.04

First update system

$ sudo apt update

Enter the following to install Ansible:

$ sudo apt install ansible -y

To check the version of Ansible installed, run the following command:

$ ansible --version

Output:

ansible 2.9.6
   config file = /etc/ansible/ansible.cfg
   configured module search path = ['/home/linoxide/.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.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

The main configuration file is saved in / etc / ansible / hosts File.


2. Install Docker and Docker Compose

A successful installation and configuration of Docker can be found under How to Install Docker On Ubuntu 20.04

After the Docker installation, check the version:

$ docker version

Output:

Client: Docker Engine - Community
  Version:           20.10.6
  API version:       1.41
  Go version:        go1.13.15
  Git commit:        370c289
  Built:             Fri Apr  9 22:47:17 2021
  OS/Arch:           linux/amd64
  Context:           default
  Experimental:      true
 Server: Docker Engine - Community
  Engine:
   Version:          20.10.6
   API version:      1.41 (minimum version 1.12)
   Go version:       go1.13.15
   Git commit:       8728dd2
   Built:            Fri Apr  9 22:45:28 2021
   OS/Arch:          linux/amd64
   Experimental:     false
  containerd:
   Version:          1.4.4
   GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
  runc:
   Version:          1.0.0-rc93
   GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
  docker-init:
   Version:          0.19.0
   GitCommit:        de40ad0

For information on installing Docker Compose, see How to Install Docker Compose on Ubuntu 20.04.

After installing Docker Compose, check the version:

$ docker-compose version

Output:

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

3. Install Node and NPM

Next, install Node.js

$ sudo apt install -y nodejs npm

and also install NPM

$ sudo npm install npm --global

4. Install Ansible AWX on Ubuntu 20.04

Now that we’ve gone through the previous installations, it’s time to install Ansible AWX.

To install docker-py python Module with the following command:

$ sudo apt install python3-pip git pwgen vim

To install inquiry which enables the sending of HTTP / 1.1 requests:

$ sudo pip3 install requests==2.22.0

We also need a Docker Compose module for Python that matches your installed Docker Compose version.

$ docker-compose version

Output:

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Check the Docker-Compose version (mine is 1.29.2) and install modules with the following command.

$ sudo pip3 install docker-compose==1.29.2

After installing pi modules we will download the latest AWX zip file from GitHub with the following command.

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

Extract downloaded directory:

$ unzip 17.1.0.zip

And change the directory to awx-17.1.0 / Installer /

$ cd awx-17.1.0/installer/

Generate a secret key or generate a random password for AWX with the following command:

$ pwgen -N 1 -s 30

Output:

6YJ0TM4MsmpKIrNCqEVA1i4TAa3zbG

Next you will find a inventory File and open it with your preferred editor:

$ sudo nano inventory

Try to keep the following settings:

NOTE: replace secret key with the just generated:

dockerhub_base=ansible 
awx_task_hostname=awx 
awx_web_hostname=awxweb 
postgres_data_dir=/tmp/pgdocker 
host_port=80 
host_port_ssl=443 
docker_compose_dir=/tmp/awxcompose 
pg_username=awx 
pg_password=awxpass 
pg_database=awx 
pg_port=5432 
admin_user=admin 
admin_password=password 
create_preload_data=True 
secret_key=6YJ0TM4MsmpKIrNCqEVA1i4TAa3zbG

Now that you’ve matched this configuration with yours, it’s time to run the playbook with the following command:

$ ansible-playbook -i inventory install.yml

install.yml – is the name of the playbook file

-I tells ansible to use the inventory file

Installation output:


ansible-playbook install.yml

Make sure everything is going well with no failed tasks.

After installing ansible-playbook, check Docker containers for a list of running containers:

$ docker ps

Output:


Docker container list

As you can see, an Ansible script creates and starts 4 Docker containers:

  • awx_task
  • awx_web
  • awx_redis
  • awx_postgres

For us the most important thing is awx_web which runs on port 80.

You can access the Ansible AWX Web UI from hostip or Hostname at the port 80.


Ansible AWX login page

Sign in using the previously in. defined login data inventory File.


Ansible AWX dashboard

After logging in, the main dashboard will be displayed. From there, you can start managing Ansible AWX and enjoy the dashboard overview.

diploma

In this tutorial we learned how to install Ansible AWX on Ubuntu 20.04 using ansible-playbook with Docker containers.