Welcome to today’s guide on how to install Ansible AWX on Ubuntu 18.04 with Nginx Reverse Proxy and optional Let’s Encrypt SSL Certificate. Ansible AWX is an open source tool which provides a web-based user interface, REST API, and task engine for easy and collaborative management of Ansible Playbooks and Inventories.

AWX allows you to centrally manage Ansible playbooks, inventories, Secrets, and scheduled jobs from a web interface. It is easy to install AWX on Ubuntu 18.04 (Bionic Beaver) Linux system. Use the steps shared below to install and configure Ansible AWX on Ubuntu 18.04 Linux server.

Setup minimum requirements

  • Ubuntu 18.04 LTS Server
  • At least 4GB of RAM – More is better
  • 2vcpus – Pump more if you have
  • 10GB free disk storage
  • root or user with sudo for ssh

Step 1: Update Ubuntu system

Update and upgrade your system

sudo apt update && sudo apt -y upgrade
sudo reboot

Step 2: Install Ansible on Ubuntu

Install the latest release of Ansible using the commands below.

echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/ansible.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt update
sudo apt install -y ansible

Use the command below to check your Ansible version.

$ ansible --version
ansible 2.8.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ubuntu/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
 python version = 2.7.15+ (default, Oct  7 2019, 17:39:04) [GCC 7.4.0]

Step 3: Install Docker and Docker Compose

Ansible AWX services will run as docker containers. We need Docker Engine to power the environment.

Install Docker on Ubuntu 18.04

Install Docker Compose:

How To Install Latest Docker Compose on Linux

You should be able to print Docker version after installation.

$ docker version
Client: Docker Engine - Community
 Version:           19.03.4
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        9013bf583a
 Built:             Fri Oct 18 15:54:09 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       9013bf583a
  Built:            Fri Oct 18 15:52:40 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Step 4: Install Node and NPM

Install Node.js and NPM on your Ubuntu system.

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

Step 5: Install Ansible AWX on Ubuntu 18.04

Install docker-py python module by executing below commands in your terminal.

sudo apt -y install python-pip git pwgen vim
sudo pip install requests==2.14.2

Install docker-compose module which matches your Docker Compose version.

$ docker-compose version
docker-compose version 1.24.1, build 4667896
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018

$ sudo pip install docker-compose==1.24.1

Clone AWX source code from GitHub using the git command.

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

Change to the AWX installer directory

Since you need to execute ansible playbooks under installer directory, first navigate to this directory.

cd awx/installer/

Check the inventory file in the awx directory, you can customize as you want:

$ nano inventory

Generate AWX secret key

$ pwgen -N 1 -s 30
2fCkx2K5GnIjBz4OterhOC3ey0WPdj

Modify inventory file with correct settings for your setup. Minimal settings:

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
rabbitmq_password=awxpass
rabbitmq_erlang_cookie=cookiemonster
admin_user=admin
admin_password=StrongAdminpassword
create_preload_data=True
secret_key=2fCkx2K5GnIjBz4OterhOC3ey0WPdj

Execute playbook

Run ansible-playbook command followed by option -i which tells it the inventory file to use. The name of the playbook file is install.yml.

ansible-playbook -i inventory install.yml

Installation output, check if you got any error messages.

Use the docker ps command to get a list of running containers.

Step 6: Access Ansible AWX Dashboard

The web portal is accessible via hostip_or_hostname:8000 or port 80 if you didn’t change it. You will get a welcome dashboard similar to one below.

Login with admin user account password set in the inventory file. Once you authenticate, you’ll get to AWX administration dashboard.

Similar articles:

How To Install and Configure Ansible Tower on CentOS 7

Install Ansible AWX on CentOS 7 / Fedora

Semaphore – Manage Ansible Tasks from A Web UI