User Tools

Site Tools



qclug_awx.pdf qclug_awx.odp

These steps were taken mostly from the upstream installation doc found here:

Install Docker and AWX deps

# sudo curl -fsSL | sudo apt-key add -
# echo 'deb [arch=amd64] xenial stable' | sudo tee /etc/apt/sources.list.d/docker.list
# sudo apt-get update && sudo apt-get install docker-ce python-virtualenv python python-dev build-essential git

Clone AWX

# git clone
# cd awx
# git checkout -b 1.0.6 1.0.6

Create a virtualenv and install ansible

# virtualenv -p `which python2` venv
# source venv/bin/activate
# pip install ansible docker-py

Configure AWX installation

# cd installer
# vim inventory

Set the postgres variables and optionally set pg_hostname if an external database is desired, otherwise if left commented out a new postgres database will be created locally in a separate container.

# pg_hostname=postgresql

Set the default admin username and password


Also set the secret_key to something unique


Install AWX

# ansible-playbook -i inventory install.yml

Add/Import inventory

Login to the awx_web container

# docker exec -it awx_web bash

Create the following directory/file structure (or use your existing inventory structure…)

inventory/               <- directory
├── group_vars           <- directory
│   ├── all              <- file
│   └── production       <- file
├── host_vars            <- directory
│   └──       <- file
└── production           <- file

Use awx-manage to import the inventory

# cd inventory
# awx-manage inventory_import --source=./ --inventory-id=1 --overwrite

Browse to the following URL to view.


Add an SSH key/credential to AWX

  • Browse to the Credentials section of the AWX dashboard and create a new credential
  • Give it a name, make it a Machine Credential type
  • Set the username and copy/paste a private SSH key (id_rsa typically) into the SSH Private Key box
  • If the private key is secured using a passphrase you can enter that into this page as well
  • Click save

Add Project/ansible code to AWX

  • Browse to the Projects section of the AWX dashboard and add your ansible git repo using the SCM URL field of your new project
  • Click the “Get latest SCM revision” link next to your project to clone your ansible repo

Create Job Template

  • Click Templates and add a new Job Template
  • Set the name to an appropriate name for the playbook that you intend to run
  • Select the playbook you would like AWX to run when you run this job
  • Select the inventory that should be used for this job
  • Select the credential that should be used for this job
  • Optionally set the “Limit” field to the group you would like the playbook to run against
  • If the job requires explicit root prilidges you can click the “Enable Privilege Escalation” checkbox
  • Click save

Execute job using the AWX dashboard

  • Click the “Start Job” icon next to the job template to run it
  • Job output should be displayed

Execute Job via API

wiki/qclug_presentations/awx.txt · Last modified: 2018/05/08 22:39 by Aaron Johnson