Developer Community


Ansible & AWX: Building the Ubuntu Linux Host Server

There is no doubt that automation will play a growing part in the future of networking. Ansible is a free automation tool that has already been used for many years in the server space, and is spreading into the network area. With the recent release of the Aruba Switching Modules for Ansible, it is relevant for more than just the large or cloud-centric data centres.


There are some excellent resources about automation, Ansible, etc in the ABC Airheads Broadcasting Channel on YouTube, including Intro to Ansible with Aruba Switching Modules.


Not everybody is a regular Linux user; in this post and subsequent ones, I want to make it as easy as possible to prepare an environment to get started with Ansible. Following posts will include Aruba module installs, testing, etc.


Component Overview

  • Ansible is the automation engine. (Acquired by Red Hat in October 2015).
  • AWX is a GUI environment for Ansible. Tower from Red Hat is the commercial offering.
  • Ubuntu Linux - host platform in this series for Ansible and AWX.

Linux Install

I have based the build in this example on Ubuntu Server 18.04 LTS (for Long Term Support - up to April 2023). Note that Ubuntu 18.04 has moved to a whole new set of mechanisms for configuration that are quite different to those you may be used to in 16.04. Apparently they are closer to System 5 rather than Debian, and there is much ongoing discussion.




Installation process

  1. Prepare your hypervisor environment (I am using ESX)
  2. Create a new Virtual Machine based on Ubuntu Linux 64 bit
  3. RAWX1 - VM config.pngesources: 2 vCPU, 4Gb mem, 1NIC, 20GB disk

  4. Attach the ISO downloaded before (ubuntu-18.04.2-live-server-amd64.iso), and boot
  5. Follow the server installation process
    - choose language
    - Keyboard config
    - Choose Install Ubuntu
    - network config (leave it at DHCP for now)
    - proxy setting
    - Ubuntu mirror source (leave at default)
    - Disk setup (leave at default of use entire disk; LVM if you need to change partition sizes in the future)
    - Server and account details (I used awxadmin for the username)
    - Install OpenSSH server
    - don't choose anything else
  6. Reboot when complete and remove the pointer to the ISO file

Linux Post Install and Tweaks
Now for all the post-install updates and tweaks.


It is best to run all of the following commands as superuser/root. Either add "sudo " before each command, or run "sudo -s" to set the elevated privilege until you end the session.


Network Connectivity
Ubuntu 18.04 changes network management significantly. YAML files and netplan is how it is done now.


Two useful references:

Run the command "ip a" (short for ip address) to verify current network settings and IDs. In this case, ens160 has the matching DHCP address and is the one to be modified.


Edit the networking YAML file:

nano /etc/netplan/50-cloud-init.yaml

AWX1 - network config yaml.png


make the changes permanent with "netplan apply"



dpkg-reconfigure tzdata

Colouring your CLI
I thought I did two identical installs - one had a colour CLI (TERM=xterm-256color), and the other a mostly B/W CLI (TERM=xterm). Run "env | grep term" to check. No idea what was done differently, but you can fix it by running "nano .bashrc" and adding the following to the end:

if [ "$TERM" == "xterm" ]; then
  # No it isn't, it's gnome-terminal
  export TERM=xterm-256color

GUI Install
The GUI is optional - you don't need a GUI for this solution to work. There are also multiple options for desktop environments and metaphors, or other management options such as webmin. The example here installs a base version of the default Ubuntu desktop.

apt update
apt install --no-install-recommends ubuntu-desktop

For a full desktop install, with Open Office, games, etc, remove the "--no-install-recommends". Total install is then 2088MB vs 771MB.


Install RDP host software
I am used to managing all my windows servers with RDP (MSTSC). VNC is a commonly used alternative.

apt install xrdp
systemctl enable xrdp

You can now access your Linux machine via RDP on Windows. If you are launching from the Run box (Windows-R), try this command:

mstsc /v:a.b.c.d /w:1280 /h:1024

AWX1 - MSTSC.png


This will launch RDP client, and you can login from there

AWX1 - xorg login.png


You will probably get an additional login inside the GUI, and a request to create a colour managed device - click Cancel.


Whilst you are there, install the software updates. Click the Activities heading on the top left of the screen and click the gear icon to watch update progress. Restart when requested.

AWX1 - software updates.png


GUI Settings
From the GUI, change the time before the screen blanks and you need to re-enter the password. Click the drop-down arrow in the top right corner, and choose the tools.

AWX1 - settings in GUI.png


Settings > Power > Power Saving > Blank Screen

Change it to a time that suits

AWX1 - blank screen setting.png


GUI Text Editor
If vi and vi improved (VIM) are not your thing, Geany comes well recommended.

apt install geany

Geany will now appear in the list of installed application in the GUI.

AWX1 - geany installed.png

AWX1 - sample geany display.png


Geany is a great editor, however when displaying YAML files, there is no assistance with the very specific spacing required.

An alternative editor with specific support for YAML is Sublime Text .
Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use.
How to Install Sublime Text 3 on Ubuntu 18.04

Install Ansible
Follow the instructions from
Remember that all commands need to have elevated privileges - use "sudo -s" at the start of the session.

apt update && apt upgrade -y
nano /etc/apt/sources.list

Add the following extries at the end (I remarked out all the others)


apt update
apt-add-repository --yes --update ppa:ansible/ansible
apt install ansible -y

Install AWX
Continue to follow the instructions from

apt install -y
apt install python-pip -y
pip install docker
pip install docker-compose [this entry is not in the instructions]
apt install nodejs npm -y
npm install npm --global
git clone
cd awx/installer
nano inventory

The default installation puts the postgres database into the /tmp directory - most data would be lost on reboot. This needs to change to a persistent directory.

  • Change postgres_data_dir=/tmp/pgdocker to something permanent such as postgres_data_dir=/awx/db
  • Change docker_compose_dir=/tmp/awxcompose to something permanent such as docker_compose_dir=/awx/compose
ansible-playbook -i inventory install.yml

AWX is now installed, test by browsing to http://{your_server} and logging in with admin/password.

AWX1 - AWX installed.png


Errors and Troubleshooting
These are some of the issues I came across. Hopefully you won't see them when you follow my steps, but Linux.


Ansible scripted Iinstall of AWX fails
Error after running this command

ansible-playbook -i inventory install.yml

TASK [local_docker : Start the containers] *************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: No module named compose"}
to retry, use: --limit @/home/rwl/awx/installer/install.retry

PLAY RECAP *********************************************************************
localhost : ok=8 changed=0 unreachable=0 failed=1

Run the suggested command, and rerun

pip install docker-compose
ansible-playbook -i inventory install.yml

AWX1 - AWX install script successful.png


Multiple errors
Errors such as these:

Unhandled error:
raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
AnsibleError: Unable to create local directories(/home/rwl/.ansible/tmp): [Errno 13] Permission denied: '/home/rwl/.ansible/tmp'
raise AnsibleError("Invalid settings supplied for %s: %s\n%s" % (config, to_native(e), traceback.format_exc()))
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/home/rwl/.ansible/tmp): [Errno 13] Permission denied: '/home/rwl/.ansible/tmp'

Most likely caused by not elevating privilege with sudo. Remember to use "sudo -s" at the beginning of each session.


Dealing with Docker


One of the key problems when installing AWX is that the tmp folder is used...nothing will work after a restart if this is not changed. Instructions provided in "Install AWX" above.


Use "docker ps -a" to check all docker containers. Note that the two Ansible/AWX containers are listed as Exited.


AWX1 - docker ps -a.png


Trying to start a container in docker manuallyAWX1 - docker start name.png



Stop and remove a container


AWX1 - stop remove container.png


This is what it should look like


AWX1 - what docker should look like.png


Richard Litchfield, HPE Aruba
Regional Category Manager, APJ – Campus Switching
Aruba Employee

Re: Ansible & AWX Part 1: Building the Ubuntu Linux Host Server

Hi Richard!

This is an excellent post with great information about Ansible.  I'd suggest this be cross-posted over to our Developer Community forums where we discuss programmability and automation, here:




Search Airheads
Showing results for 
Search instead for 
Did you mean: