How to Install Ansible AWX 17.1.0 on Ubuntu 20.04

Channel: Linux
Abstract: $ docker-compose version Outputthat matches your Docker Compose installed version. $ docker-compose version Output

AWX is an open-source community project sponsored by Red Hat. It serves as the development environment for the Ansible Tower. AWX will have frequent releases and have all new developments.

Ansible AWX provides a web-based user interface to manage Ansible hosts, playbooks, modules, job scheduling, workflow automation, credential sharing, and tooling to enable delegation.

In this tutorial, we are going through the installation process of Ansible AWX on Ubuntu 20.04.

How to install terraform on ubuntu ...

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video

How to install terraform on ubuntu 20.04

Prerequisites

  • root access, or user with sudo privileges for SSH connection.
  • Ubuntu 20.04 or 18.04
  • Minimum 4GB ram
  • Minimum 2vcpus
  • Minimum 20GB free storage space

For the purpose of successful up and running Ansible AWX will also need to have installed:

  • Ansible
  • Docker and Docker compose
  • Node and NPM
1. Install Ansible on Ubuntu 20.04

First update system

$ sudo apt update

To install Ansible, type:

$ sudo apt install ansible -y

To verify the version of installed Ansible run the 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 stored in /etc/ansible/hosts file.

2. Install Docker and Docker Compose

For a successful installation and configuration of Docker, refer How to Install Docker On Ubuntu 20.04

After Docker installation, verify 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 Docker Compose installation, refer How to Install Docker Compose on Ubuntu 20.04.

After Docker Compose installation, verify 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

Once we've gone through the previous installations, it's time to install Ansible AWX.

Install docker-py python module with following command:

$ sudo apt install python3-pip git pwgen vim

Install request which allows to send HTTP/1.1 requests:

$ sudo pip3 install requests==2.22.0

Also, we gonna need a docker-compose module for python, that matches your Docker Compose installed 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 at docker-compose version (my is 1.29.2) and install modules with the following command.

$ sudo pip3 install docker-compose==1.29.2

After installing pi-modules, we are going to download the latest AWX zip file from GitHub with the following command.

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

Unzip downloaded directory:

$ unzip 17.1.0.zip

And change directory to awx-17.1.0/installer/

$ cd awx-17.1.0/installer/

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

$ pwgen -N 1 -s 30

Output:

6YJ0TM4MsmpKIrNCqEVA1i4TAa3zbG

Next, find a inventory file and open it with favorite editor:

$ sudo nano inventory

Try to keep the following setings:

NOTE: replace secret key with the one we 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

After matching this configuration with your, it's time to execute the playbook with the following command:

$ ansible-playbook -i inventory install.yml

install.yml - is name of playbook file

-i tells ansible to use inventory file

Installation Output:

ansible-playbook install.yml

Verify that everyting goes well, without failed tasks.

After ansible-playbook installation, check docker containers to get a list of running containers:

$ docker ps

Output:

docker container list

As you can see, an ansible script creates and start 4 docker-containers:

  • awx_task
  • awx_web
  • awx_redis
  • awx_postgres

For us is most important awx_web which is running on port 80.

You can access Ansible AWX Web-UI via hostip or hostname on port 80.

Ansible AWX Login Page

Login with credentials that previously defined in inventory file.

Ansible AWX Dashboard

After login will see the main dashboard. From there you can start managing Ansible AWX and enjoy the dashboard overview.

Conclusion

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

Ref From: linoxide
Channels:

Related articles