Introduction

Ansible AWX is an OpenSource upstream project that supports RedHat’s Ansible Tower. With Ansible AWX, Ansible playbooks can be automated and managed in a way that allows for (amongst other things) an Infrastructure as code CI/CD pipeline. AWX can organise ansible-playbooks into projects and allow different inventory sources and credentials to be managed in an easy to use an effective manager. A powerful feature of AWX is that it allows for the bootstrapping of an Ansible playbook - meaning that once cloud infrastructure (such as an EC2 instance) is built (for example using CloudFormation or Terraform), the EC2 instance can bootstrap an Ansible Playbook for config management, using that EC2 instance as an inventory item.

This following guide will demonstrate install AWX on Ubuntu 18.04LTS

First we start by updating and upgrading our freshly deployed Ubuntu 18.04 LTS environment:

$ sudo apt update -y && sudo apt upgrade -y

Enable the “Universe” Repositories in Ubuntu:

$ sudo add-apt-repository universe

Update apt:

$ sudo apt update

Next we shall install the required packages for AWX:

$ sudo apt install docker.io docker-compose ython-pip nodejs npm -y

We also need Anisble, which we will get from the official Asnible repository rather than the Ubuntu Universe. Firstly, we need the key:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367

Next, we add the repository:

sudo apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic main"

Now, we grab Ansible:

$ sudo apt install ansible

A quick check of the version:

$ ansible --version
ansible 2.8.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/matt/.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.16 (default, Apr  9 2019, 04:50:39) [GCC 8.3.0]

We need the Docker Compose and the Docker SDK for python, which we install through pip:

  sudo pip install docker docker-compose

To make life easier, we’ll add our current user to the docker user group, allowing manipulation of Docker without the need for sudo privileges - you will need to log out and then back in, for these to apply:

  sudo usermod -aG docker $USER

Let’s ensure docker is set to automatically start on boot, and start docker:

$ sudo systemctl enable docker
$ sudo systemctl start docker

Test all is working with the following:

  $ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

With that complete, it is time to update NPM:

npm install npm --global

With that, it is finally time to download the source for AWX, and install it using ansible.

$ git clone https://github.com/ansible/awx.git
$ cd awx/installer

Please feel free to modify the defaults in the “inventory” file before deploying:

$ vim inventory

Once happy, run the ansible playbook:

$ ansible-playbook -i inventory install.yml

Once complete, you should be able to browse to

http://<servername>

And access your AWX Server. the user name and password you use, will be what you defined in your inventory file. Otherwise, AWX will default to ‘admin’ and ‘password’