====== Presentation ====== {{wiki/qclug_presentations/qclug_awx.pdf}} {{wiki/qclug_presentations/qclug_awx.odp}} **//These steps were taken mostly from the upstream installation doc found here://** https://github.com/ansible/awx/blob/devel/INSTALL.md ==== Install Docker and AWX deps ==== # sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # echo 'deb [arch=amd64] https://download.docker.com/linux/ubuntu 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 https://github.com/ansible/awx.git # 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 pg_username=awx pg_password= pg_database=awx pg_port=5432 **//Set the default admin username and password//** default_admin_user=admin default_admin_password= **//Also set the secret_key to something unique//** secret_key= ==== 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 │   └── 172.17.0.1 <- 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.//** http://localhost/#/inventories/inventory/1 ==== 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 ====