This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
wiki:qclug_presentations:awx [2018/05/08 20:46] Aaron Johnson created |
wiki:qclug_presentations:awx [2018/05/08 22:39] (current) Aaron Johnson |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Presentation ====== | ====== Presentation ====== | ||
- | {{wiki/qclug_presentations/}} | + | {{wiki/qclug_presentations/qclug_awx.pdf}} |
+ | {{wiki/qclug_presentations/qclug_awx.odp}} | ||
- | Note: These steps were taken mostly from the upstream installation doc found here: | ||
- | AWX Installation - https://github.com/ansible/awx/blob/devel/INSTALL.md | + | **//These steps were taken mostly from the upstream installation doc found here://** |
- | ====== Install Docker and AWX deps ====== | + | https://github.com/ansible/awx/blob/devel/INSTALL.md |
+ | |||
+ | ==== Install Docker and AWX deps ==== | ||
<code> | <code> | ||
Line 15: | Line 17: | ||
</code> | </code> | ||
- | ===== Clone AWX ===== | + | ==== Clone AWX ==== |
<code> | <code> | ||
Line 38: | Line 40: | ||
</code> | </code> | ||
+ | **//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.//** | ||
+ | |||
+ | <code> | ||
+ | # pg_hostname=postgresql | ||
+ | pg_username=awx | ||
+ | pg_password=<secret> | ||
+ | pg_database=awx | ||
+ | pg_port=5432 | ||
+ | </code> | ||
+ | |||
+ | **//Set the default admin username and password//** | ||
+ | |||
+ | <code> | ||
+ | default_admin_user=admin | ||
+ | default_admin_password=<secret> | ||
+ | </code> | ||
+ | |||
+ | **//Also set the secret_key to something unique//** | ||
+ | |||
+ | <code> | ||
+ | secret_key=<secret_key> | ||
+ | </code> | ||
+ | |||
+ | ==== Install AWX ==== | ||
+ | |||
+ | <code> | ||
+ | # ansible-playbook -i inventory install.yml | ||
+ | </code> | ||
+ | |||
+ | ==== Add/Import inventory ==== | ||
+ | |||
+ | **//Login to the awx_web container//** | ||
+ | |||
+ | <code> | ||
+ | # docker exec -it awx_web bash | ||
+ | </code> | ||
+ | |||
+ | **//Create the following directory/file structure (or use your existing inventory structure...)//** | ||
+ | |||
+ | <code> | ||
+ | inventory/ <- directory | ||
+ | ├── group_vars <- directory | ||
+ | │ ├── all <- file | ||
+ | │ └── production <- file | ||
+ | ├── host_vars <- directory | ||
+ | │ └── 172.17.0.1 <- file | ||
+ | └── production <- file | ||
+ | </code> | ||
+ | |||
+ | **//Use //**''awx-manage''**// to import the inventory//** | ||
+ | |||
+ | <code> | ||
+ | # cd inventory | ||
+ | # awx-manage inventory_import --source=./ --inventory-id=1 --overwrite | ||
+ | </code> | ||
+ | |||
+ | **//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 ==== | ||