In the previous lesson you left AWX installed on awx1 and a Gitea server waiting at git.aurora-store.example, but AWX is empty and aurora-infra still lives only on your laptop. In this lesson you'll go all the way, from start to finish, through turning ansible-playbook site.yml into an AWX run: you'll tour the interface, publish Aurora's repositories on Gitea, make the small adjustments aurora-infra needs in order to run outside your computer, create the Aurora Store organization with the bare essentials (credentials, project and inventory) and, above all, the job template that runs site.yml. You'll learn to launch it with its options (limit, tags, verbosity, check mode, variables, prompts on launch and surveys), read a job's output, relaunch it, schedule runs and launch it from the command line and the API. The details of projects and inventories are covered in Lesson 7.4, and those of credentials and permissions in 7.5: here you'll use just enough to make everything work.
Contents
- A tour of the interface
- Preparing
aurora-infrato run outside your laptop - The
Aurora Storeorganization - The minimum credentials
- The
aurora-infraproject - The
Aurora - Labinventory - The first job template
- Launching the job and reading its output
- Relaunching jobs
- Template options: prompt on launch and surveys
- Scheduling runs (Schedules)
- Notifications
- Launching templates from the command line and the API
- A tour of the interface
Log in to http://192.168.56.30:30080 as admin. The side menu groups the objects you met in Lesson 7.1. The exact layout and some names change between AWX versions (and in AAP 2.5 and later the interface is the unified platform's), but the objects are the same:
| Section | Items | What for |
|---|---|---|
| Views | Dashboard, Jobs, Schedules, Activity Stream, Workflow Approvals, Host Metrics | Seeing the status: overview, job history, schedules, configuration change log, pending approvals |
| Resources | Templates, Credentials, Projects, Inventories, Hosts | What defines the automation |
| Access | Organizations, Users, Teams | Who's who and who can do what (Lesson 7.5) |
| Administration | Credential Types, Notifications, Management Jobs, Instance Groups, Instances, Applications, Execution Environments | Platform configuration |
| Settings | Authentication, jobs, system, user interface… | Global options |
Two useful details:
- Each object is created with the Add button on its list and has tabs (Details, Access, Notifications, Schedules, Jobs… depending on the type).
- Activity Stream records every configuration change (who created or modified which object and when): it's the platform's own audit trail, complementing the job history.
- Preparing
aurora-infra to run outside your laptop
aurora-infra to run outside your laptopAs you saw in Lesson 7.1, AWX jobs run in a container that has nothing from your computer. Before creating anything in AWX, aurora-infra needs four adjustments. This section makes them with a brief explanation; Lesson 7.4 explains the reasons behind each one in depth.
| Problem in AWX | Adjustment | In-depth explanation |
|---|---|---|
| AWX only fetches projects from a Git server | Publish aurora-infra and ansible-role-nginx on Gitea |
7.4 |
The nginx role is downloaded from git+file:///home/student/aurora-git/..., which doesn't exist in AWX (the Module 6 warning) |
New URL http://git.aurora-store.example/...; AWX only reads roles/requirements.yml and collections/requirements.yml |
7.4 |
ansible.cfg points to ~/.ansible/vault/aurora-lab.pass, which doesn't exist in AWX (and would fail when it couldn't find it) |
The Vault password is supplied through an environment variable locally and through a credential in AWX | 7.5 |
AWX imports the inventory from inventory/ and can't decrypt Vault-encrypted files while doing so |
The two vault.yml files move out of inventory/ into group_vars/ next to the playbooks |
7.4 |
2.1. The repositories on Gitea
Log in to http://git.aurora-store.example/ as alex and create:
- An organization
ops(+ menu → New Organization), with public visibility. - Inside
ops, theaurora-infrarepository, private and empty (no README,.gitignoreor license: you already have the content). - Inside
ops, theansible-role-nginxrepository, public and empty. Public on the internal server means it can be read without credentials, which makes it simpler for AWX and any project to download it as a dependency; it contains no secrets (you checked that in Lesson 6.4). In a company, an internal server isn't exposed to the Internet; if a dependency can't be readable without credentials, Lesson 7.4 discusses alternatives. - Optionally,
ansible-collection-infra(private), to move the Module 6 collection over as well.
AWX needs a read-only user of its own to clone aurora-infra. On awx1, create the awx user and an access token with permission to read repositories (save it in your password manager; Gitea only shows it once):
sudo podman exec -u git gitea gitea admin user create \
--username awx --email [email protected] \
--random-password --must-change-password=false
sudo podman exec -u git gitea gitea admin user generate-access-token \
--username awx --token-name awx-aurora --scopes read:repositoryThen, in the Gitea web interface, inside the ops organization, create a team read with read permission on all of the organization's repositories and add the awx user to it. That way, awx can clone aurora-infra but not modify it.
Push the repositories from your computer. Git will ask for your user (alex) and its password; to avoid typing it on every operation, you can enable a temporary credential cache:
git config --global credential.helper 'cache --timeout=3600'
cd ~/aurora-infra
git remote add origin http://git.aurora-store.example/ops/aurora-infra.git
git push -u origin main
cd ~/ansible-role-nginx
git remote set-url origin http://git.aurora-store.example/ops/ansible-role-nginx.git
git push -u origin main --tagsaurora-infrahad no remote: you create it withgit remote add.- In
ansible-role-nginx,originpointed to~/aurora-git/ansible-role-nginx.git: you change it withset-urland push the branch and the1.0.0tag (--tags). - If you created
ansible-collection-infra, do the same in~/ansible_collections/aurora_store/infra.
Security: in the lab, Git goes over unencrypted HTTP; in a company, Gitea would be behind HTTPS and the URL would be
https://git.aurora-store.example/.... Passwords and tokens travel with every request, so unencrypted HTTP is only acceptable on a private practice network.
2.2. Dependencies in two files
AWX looks for dependencies in two fixed paths in the project: roles/requirements.yml for roles and collections/requirements.yml for collections. It doesn't read the unified requirements.yml at the root that you created in Lesson 6.3. Split it into those two files. Create roles/requirements.yml:
---
# External roles of aurora-infra (Lessons 6.3, 7.3 and 7.4).
#
# AWX processes it automatically when syncing the project (fixed path).
# Locally: ansible-galaxy role install -r roles/requirements.yml
# (add --force after changing the version of a role)
# Installed in galaxy_roles/ (first path in roles_path); not versioned.
# PINNED versions: only changed after testing them in the lab.
roles:
# Aurora Store's own role, shared from its repository (Lesson 6.4).
# Lab: http (no TLS). In the company: https://git.aurora-store.example/...
- name: nginx
src: git+http://git.aurora-store.example/ops/ansible-role-nginx.git
version: "1.0.0"
# Prometheus metrics agent. Evaluated in Lesson 6.1; used in monitoring.yml.
- name: geerlingguy.node_exporter
version: "2.2.0"And collections/requirements.yml:
---
# Collections of aurora-infra (Lessons 6.3, 7.3 and 7.4).
#
# AWX processes it automatically when syncing the project (fixed path).
# Locally: ansible-galaxy collection install -r collections/requirements.yml
# Installed in collections/ansible_collections/ (not versioned).
collections:
# ufw and timezone. The 12 series is the latest compatible with ansible-core 2.17.
- name: community.general
version: "12.6.7"
# PostgreSQL users, databases and checks.
- name: community.postgresql
version: "4.2.2"
# timer, profile_tasks and profile_roles callbacks.
- name: ansible.posix
version: "2.2.2"The content is the same as always; only the location and the URL of the nginx role change. Since collections/ was ignored entirely in .gitignore, change that line to ignore only what gets installed, so you can version the requirements file:
Delete the old file and reinstall from the new locations (--force downloads nginx again, this time from Gitea, to check that the new URL works):
cd ~/aurora-infra
git rm -q requirements.yml
ansible-galaxy role install -r roles/requirements.yml --force
ansible-galaxy collection install -r collections/requirements.ymlStarting galaxy role install process
- changing role nginx from 1.0.0 to 1.0.0
- extracting nginx to /home/student/aurora-infra/galaxy_roles/nginx
- nginx (1.0.0) was installed successfully
- changing role geerlingguy.node_exporter from 2.2.0 to 2.2.0
...
Nothing to do. All requested collections are already installed. ...2.3. The Vault password and the encrypted files
First, ansible.cfg. Remove this line from [defaults]:
and, to keep working the same way in your terminal, define the same value as an environment variable in your ~/.bashrc (or your shell's startup file):
echo 'export ANSIBLE_VAULT_IDENTITY_LIST=lab@~/.ansible/vault/aurora-lab.pass' >> ~/.bashrc
source ~/.bashrcANSIBLE_* variables have the same effect as their option in ansible.cfg (Lesson 2.3). The difference is that the path to the password is now specific to your computer and isn't in the repository, which is exactly how it should be: each place where Aurora runs supplies the password in its own way (your terminal with this variable, AWX with a credential, the continuous integration of Lesson 8.3 with its own).
Next, the encrypted files. Move them from the inventory to the group_vars/ directory at the project root, next to the playbooks:
mkdir -p group_vars/all group_vars/dbservers
git mv inventory/group_vars/all/vault.yml group_vars/all/vault.yml
git mv inventory/group_vars/dbservers/vault.yml group_vars/dbservers/vault.ymlAnsible loads group_vars/ both next to the inventory and next to the playbook (Lesson 3.5), so ansible-playbook still finds vault_aurora_db_password and vault_aurora_reporting_db_password exactly as before. What changes is that the inventory no longer contains anything encrypted, so AWX will be able to import it. The inventory variables that use those secrets (aurora_db_password: "{{ vault_aurora_db_password }}" and the ones in postgresql_users) stay where they were: they're templates resolved at run time.
Check that everything still behaves the same and save the changes:
site.yml --check should finish without errors and with changed=0. Commit and push:
git add .gitignore ansible.cfg roles/requirements.yml collections/requirements.yml
git commit -m "Prepare aurora-infra for AWX: requirements by type, nginx role from Gitea and secrets outside the inventory"
git pushIf everything works, the old "Git server" ~/aurora-git/ is no longer used; you can delete it once you've checked that the three repositories are on Gitea.
- The
Aurora Store organization
Aurora Store organizationAWX comes with a Default organization. Aurora will have its own: Access → Organizations → Add.
| Field | Value | Comment |
|---|---|---|
| Name | Aurora Store |
|
| Description | Automation of the Aurora Store infrastructure |
|
| Galaxy Credentials | Ansible Galaxy |
Credential AWX creates when it's installed; it allows content to be downloaded from galaxy.ansible.com when syncing the organization's projects. Without it, the requirements files aren't processed |
| Execution Environment | (empty) | AWX's default environment will be used until Lesson 7.6 |
Everything you create from now on belongs to this organization.
- The minimum credentials
Resources → Credentials → Add, once per credential, all in the Aurora Store organization. The types and their fields are covered in Lesson 7.5; here you fill in only the essentials:
| Name | Credential Type | Fields |
|---|---|---|
Aurora - Gitea (read) |
Source Control | Username: awx; Password: the Gitea token from section 2.1 |
Aurora - SSH lab |
Machine | Username: vagrant; SSH Private Key: the contents of ~/.ssh/aurora_ed25519 (cat ~/.ssh/aurora_ed25519 and paste, including the -----BEGIN and -----END lines); Privilege Escalation Method: sudo |
Aurora - Vault lab |
Vault | Vault Password: the contents of ~/.ansible/vault/aurora-lab.pass; Vault Identifier: lab |
Once saved, the secret fields are shown as $encrypted$: not even admin can read them again in the interface. The Vault Identifier lab must match the label you encrypted the files with (Lesson 5.4).
- The
aurora-infra project
aurora-infra projectResources → Projects → Add:
| Field | Value |
|---|---|
| Name | aurora-infra |
| Organization | Aurora Store |
| Source Control Type | Git |
| Source Control URL | http://git.aurora-store.example/ops/aurora-infra.git |
| Source Control Branch/Tag/Commit | main |
| Source Control Credential | Aurora - Gitea (read) |
| Options | Check Update Revision on Launch |
When you save, AWX automatically launches a sync (project update): it clones the repository and installs roles/requirements.yml and collections/requirements.yml. It's just another job; open it from the Jobs tab or from Views → Jobs. Its output is that of an internal AWX playbook; look for the role and collection download tasks and check that they finish successfully. The project should show a Successful status and the revision (the hash of the latest commit on main).
Update Revision on Launch makes AWX check for new commits before every job: that way, the latest main is always what runs.
- The
Aurora - Lab inventory
Aurora - Lab inventoryThe inventory is imported from the repository itself, so that inventory/ remains the source of truth. Resources → Inventories → Add → Add inventory:
- Name:
Aurora - Lab; Organization:Aurora Store. Save.
In the Sources → Add tab:
| Field | Value |
|---|---|
| Name | aurora-infra repository |
| Source | Sourced from a Project |
| Project | aurora-infra |
| Inventory file | inventory/ |
| Options | Overwrite, Overwrite variables and Update on launch |
Save and click Sync. When it finishes, you'll see in the inventory's tabs:
- Hosts:
lb1,web1,web2,db1, each with its variables (ansible_host,aurora_lb_weight…). - Groups:
aurora,loadbalancers,webservers,dbservers, with the variables from the inventory'sgroup_vars/.
The chosen options make the repository the authority: whatever is removed from the repository is removed from AWX (Overwrite), the variables are replaced by those in the repository (Overwrite variables) and the inventory is synced before every job (Update on launch). Lesson 7.4 covers all this in detail.
- The first job template
With a project, an inventory and credentials, you can now define what runs. Resources → Templates → Add → Add job template:
| Field | Value | Equivalent to |
|---|---|---|
| Name | Aurora - Configure infrastructure |
— |
| Description | Applies site.yml to all the Aurora Store servers |
— |
| Job Type | Run |
(no --check) |
| Inventory | Aurora - Lab |
-i inventory |
| Project | aurora-infra |
cd ~/aurora-infra |
| Execution Environment | (empty: the organization's or the global one) | Your Ansible installation |
| Playbook | site.yml (drop-down list with the project's playbooks) |
ansible-playbook site.yml |
| Credentials | Aurora - SSH lab and Aurora - Vault lab |
--private-key / -u vagrant and --vault-id lab@... |
| Variables | (empty) | -e ... |
| Forks | (empty: the default value) | -f |
| Limit | (empty) | --limit |
| Verbosity | 0 (Normal) |
-v…-vvvv |
| Job Tags / Skip Tags | (empty) | --tags / --skip-tags |
| Show Changes | unchecked | --diff |
| Options | None checked (in particular, not Concurrent Jobs) | — |
A few clarifications:
- Don't check Privilege Escalation: it's equivalent to
--becomefor the whole playbook, and Aurora's plays already declarebecome: truewhere they need it. - Leaving Concurrent Jobs unchecked means that if someone launches the template while a job from it is already running, the second one waits in the queue. That way there will never be two simultaneous
site.ymlruns fighting over the same servers. - In the Credentials field you can combine several credentials of different types (one Machine, one or more Vault credentials with different identifiers, a cloud one…).
Save. The template is ready to launch.
- Launching the job and reading its output
Click Launch (the rocket icon). AWX creates a job and opens its screen. You'll see, in order, the project update (because of Update Revision on Launch), the inventory update (because of Update on launch) and the playbook run with live output.
The job screen has two tabs:
Details: all the information needed to audit the run.
| Field | What it tells you |
|---|---|
| Status | Pending, Waiting, Running, Successful, Failed, Error or Canceled |
| Started / Finished / Elapsed | When and how long |
| Launched By | Who launched it (or which schedule) |
| Template, Inventory, Project, Playbook | What ran and against what |
| Revision | The exact aurora-infra commit that was used |
| Credentials, Execution Environment | With which secrets (without showing them) and in which environment |
| Limit, Verbosity, Job Tags, Variables | The options of this particular run |
Output: the same output you'd see in your terminal, with its colors, plus:
- A per-host status bar in the header (ok, changed, failed, unreachable, skipped) that summarizes the
PLAY RECAP. - Filters by text, by host or by event type, very useful in long runs.
- Clicking a host's result line opens the event details: the full JSON the module returned (as with
-v, but without relaunching). - A download button for the full output.
Since the servers were already configured by site.yml from your terminal, the expected result is the same one you got there: all the plays, the post_tasks checks in green and a PLAY RECAP with changed=0 on all four servers.
PLAY RECAP *********************************************************************
db1 : ok=... changed=0 unreachable=0 failed=0 skipped=... rescued=0 ignored=0
lb1 : ok=... changed=0 unreachable=0 failed=0 skipped=... rescued=0 ignored=0
web1 : ok=... changed=0 unreachable=0 failed=0 skipped=... rescued=0 ignored=0
web2 : ok=... changed=0 unreachable=0 failed=0 skipped=... rescued=0 ignored=0That changed=0 is the best proof that the migration to AWX is correct: the same code, run from somewhere else with different credentials, reaches the same state. From now on, the job stays in Views → Jobs forever (or until it's cleaned up by the maintenance jobs in Management Jobs).
Host key checking: in your terminal,
ansible.cfgchecks SSH fingerprints (host_key_checking = True). By default, AWX disables that check in its jobs (the container has noknown_hostswith your servers). It's convenient, but it means an impersonated server wouldn't be detected. It can be re-enabled in AWX's job settings by supplying the known fingerprints; you'll weigh this up in the security review in Lesson 9.2.
- Relaunching jobs
Cause a controlled failure. Shut down web2 from your computer:
Launch Aurora - Configure infrastructure again. web2 shows up as unreachable in the first play and drops out of the run (Lesson 5.5); the rest carries on and the job ends as Failed. In the output, filter by web2 to see only its error.
Start web2 (vagrant up web2) and, in the failed job, click the Relaunch button. AWX offers two options:
| Option | What it does |
|---|---|
| All | Repeats the job with exactly the same parameters |
| Failed | Repeats the job limited (--limit) to the hosts that failed or were unreachable |
Choose Failed: the new job runs only against web2 and ends as Successful. Look at its details: Limit = web2 and a link to the original job. Relaunching always creates a new job; the history keeps the failed one.
- Template options: prompt on launch and surveys
10.1. Prompt on launch
Almost every template field has a Prompt on launch checkbox. If you check it, when someone clicks Launch, AWX shows a wizard where that value can be changed for that run only. Edit Aurora - Configure infrastructure and check Prompt on launch on:
- Limit: to apply the configuration to a single server (
web1,webservers…). - Job Tags and Skip Tags: to use the functional tags from Lesson 5.6 (
config,users,packages,monitoring…). - Verbosity: to troubleshoot without modifying the template.
Launch the template with Limit lb1 and Job Tags config: it's the equivalent of ansible-playbook site.yml --limit lb1 --tags config. In Details you'll see the values used.
Whatever you don't check stays fixed: whoever launches the template won't be able to change it. This is a control tool as important as permissions: a template with few prompts is a template that's safe to delegate.
10.2. Surveys
The Variables field with Prompt on launch would allow any variable to be entered, which is too much power to delegate. A survey is a form with specific, typed and validated questions, whose answers are passed as extra variables (-e).
Create a second template for deploying the website, designed to be delegated (Lesson 7.5). Templates → Add → Add job template:
| Field | Value |
|---|---|
| Name | Aurora - Deploy web |
| Description | Rolling deployment of the store website (webservers.yml, deploy tag) |
| Job Type | Run |
| Inventory / Project | Aurora - Lab / aurora-infra |
| Playbook | webservers.yml |
| Credentials | Aurora - SSH lab and Aurora - Vault lab |
| Job Tags | deploy (without Prompt on launch) |
Save and open the Survey → Add tab:
| Question field | Value |
|---|---|
| Question | Website version to deploy |
| Description | X.Y.Z format, for example 1.2.0 |
| Answer variable name | aurora_app_version |
| Answer type | Text |
| Minimum length / Maximum length | 5 / 20 |
| Default answer | 1.1.0 |
| Required | Yes |
Save the question and enable the survey with the tab's toggle (a survey that's been created but is disabled isn't shown). When the template is launched, AWX asks for the version and, in practice, runs:
Launch it with 1.2.0. You'll see the rolling deployment from Lesson 5.7 (serial: 1, each web server leaves lb1 and comes back in) and, when it finishes, http://192.168.56.10/ will show "Version 1.2.0".
An important warning about the source of truth. Survey answers are extra variables, with the highest precedence, but they don't change the repository: inventory/group_vars/webservers.yml still says aurora_app_version: "1.1.0". The next time someone runs Aurora - Configure infrastructure, the website will go back to 1.1.0. Aurora's rule is that every deployed version must end up recorded in the repository. You'll see this in the next section, and you'll fix it there.
- Scheduling runs (Schedules)
One of AWX's advantages is periodic execution without depending on anyone's laptop. For Aurora, the most useful thing is to detect drift every night: run site.yml in check mode with diff, so that if someone has changed something by hand (or deployed without recording it), the job shows it as changed.
Create the Aurora - Check configuration template by copying Aurora - Configure infrastructure (copy button on the template list) and change:
- Name:
Aurora - Check configuration. - Job Type:
Check(equivalent to--check). - Show Changes: checked (equivalent to
--diff).
Launch it once by hand. Since you've just deployed 1.2.0 through the survey and the repository says 1.1.0, you'll see changed on web1 and web2 with the diff of the home page:
-<p><small>Version 1.2.0 - Served by web1 - aurora-store.example</small></p>
+<p><small>Version 1.1.0 - Served by web1 - aurora-store.example</small></p>That's exactly the drift you were looking for. Record it in the repository: in inventory/group_vars/webservers.yml, change aurora_app_version: "1.1.0" to "1.2.0", and then:
Launch Aurora - Check configuration again: thanks to Update Revision on Launch and Update on launch, AWX fetches the new commit and re-imports the inventory, and the result is changed=0. The repository and the servers match again.
Now schedule it. In the template, Schedules → Add tab:
| Field | Value |
|---|---|
| Name | Nightly check |
| Start date/time | Tomorrow at 06:00 |
| Local time zone | Europe/Madrid |
| Repeat frequency | Day, every 1 day |
AWX stores the schedule as a standard recurrence rule (RRULE, the same one calendars use), which you'll see in the details:
Schedules also appear in Views → Schedules, where they can be temporarily disabled (for example, during a maintenance window). The jobs they launch show the schedule's name in Launched By. Project and inventory syncs can be scheduled too.
- Notifications
A nightly check is only useful if someone finds out when it finds something. AWX sends notifications through notification templates (Administration → Notifications) of different types: email, Slack, Mattermost, Rocket.Chat, PagerDuty, Grafana, generic webhook and others. Once created, a notification is attached in the Notifications tab of a template, project or organization, choosing the events: Start, Success, Failure and, in workflows, Approval (approval pending).
For Aurora, the natural choice would be an email notification to [email protected] on Failure for all templates. Since the lab has no mail server, it's enough for you to know where it's configured. Bear in mind that in check mode, a job with pending changes ends as Successful: to alert on drift, the success notification with the job summary or a webhook that analyzes the result are common options.
- Launching templates from the command line and the API
Everything you've done with the mouse is available through the API (Lesson 7.1). Install the awx client (awxkit package) on your computer:
Configure the connection with environment variables. To keep the password out of your shell history, read it with read -s:
export TOWER_HOST=http://192.168.56.30:30080
export TOWER_USERNAME=admin
read -rsp "AWX password: " TOWER_PASSWORD; echo
export TOWER_PASSWORDQuery and launch:
id name
== ======================================
9 Aurora - Check configuration
7 Aurora - Configure infrastructure
8 Aurora - Deploy web- Templates can be specified by name or by their numeric ID.
--limit db1is only accepted because Limit has Prompt on launch; with a fixed field, AWX rejects the value.--monitorshows the output live in your terminal and exits with the job's exit code, which makes it usable in scripts and in continuous integration (Lesson 8.3).
And from any HTTP client with a token, which is the recommended approach for integrations (instead of a username and password). Create one in the interface, under your user → Tokens → Add, with Write scope, and save it in your password manager:
read -rsp "AWX token: " AWX_TOKEN; echo
curl -s -X POST \
-H "Authorization: Bearer $AWX_TOKEN" \
-H "Content-Type: application/json" \
-d '{"limit": "web1"}' \
http://192.168.56.30:30080/api/v2/job_templates/7/launch/The response is a JSON document with the ID of the job created ("job": 42, for example), whose status you can check at /api/v2/jobs/42/. Every job launched through the API stays in the history just like the others, with the token's owner in Launched By.
Common Mistakes and Tips
- The project sync fails with an authentication error: the Gitea token is wrong, it doesn't have the
read:repositoryscope, or theawxuser isn't in thereadteam. - The project syncs, but the job says
the role 'nginx' was not found: the dependencies weren't installed. Check that the files are inroles/requirements.ymlandcollections/requirements.yml(not at the root) and that the organization has the Galaxy credential. Attempting to decrypt but no vault secrets foundin the inventory sync: there's still an encrypted file insideinventory/. In a job, on the other hand, it means the template doesn't have the Vault credential or its identifier isn'tlab.The vault password file ... was not found:ansible.cfgstill hasvault_identity_list. Remove it and push.- A Limit or tags value is ignored when launching through the API: the field doesn't have Prompt on launch.
- Deploying through a survey and forgetting the repository: the next full run undoes the deployment. The nightly check detects it; always record it in Git.
- Tip: name templates with a common prefix (
Aurora - ...) and a verb that says what they do. When there are dozens of them, search and permissions will thank you for it.
Exercises
Exercise 1: Package update template
Create the Aurora - Update packages template that runs upgrade.yml (Lesson 5.8), with Limit prompted on launch and web1 as the default value. Which credentials does it need? Launch it against web1 and look in the output for the pending reboot notice, if there is one.
Exercise 2: Troubleshooting with verbosity
Launch Aurora - Configure infrastructure with Limit db1, Job Tags users and verbosity 3 (Debug). Where in the output do you see the SSH command Ansible uses, and which user does it connect as? Does the PostgreSQL password appear anywhere? Why?
Exercise 3: Weekly schedule
Schedule the template from Exercise 1 to run on Sundays at 04:00 (Madrid time) against webservers. How do you do it if Limit is prompted on launch and the schedule has nobody to answer?
Solutions
Exercise 1. Copy Aurora - Configure infrastructure or create a new one with Playbook upgrade.yml and Limit web1 with Prompt on launch checked. It needs Aurora - SSH lab (connection and sudo) and also Aurora - Vault lab: even though upgrade.yml doesn't use secrets, Ansible loads group_vars/all/vault.yml (which sits next to the playbooks) for every host in the play, and without the password it fails to decrypt it. If the system needs a reboot, you'll see the message from the "Report the servers that need a reboot" task.
Exercise 2. With verbosity 3, each task shows lines like <192.168.56.21> SSH: EXEC ssh ... -o 'User="vagrant"' ... with the connection options, just like -vvv in your terminal. The PostgreSQL password does not appear: the "Create the PostgreSQL users" task has no_log: true (Lesson 5.4) and the output shows the output has been hidden due to the fact that 'no_log: true' was specified for this result. AWX adds no extra protection to the playbook's output: whatever no_log protects (or doesn't) is the same as in your terminal.
Exercise 3. In the schedule (Schedules → Add) there's a step for filling in the fields that have Prompt on launch: that's where you set Limit = webservers for that schedule. Frequency Week, on Sundays, at 04:00 with the Europe/Madrid time zone. The resulting rule is similar to DTSTART;TZID=Europe/Madrid:20261129T040000 RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=SU. Bear in mind that upgrade.yml has no serial: it would upgrade both web servers at the same time; in production it would be wise to stagger it.
Conclusion
You've run Aurora Store's automation from AWX for the first time. To get there, you published aurora-infra (private) and ansible-role-nginx (public) in Gitea's ops organization with a read-only awx user, and you adapted aurora-infra to run outside your laptop: dependencies in roles/requirements.yml and collections/requirements.yml with the nginx role from http://git.aurora-store.example, the Vault password out of ansible.cfg (the ANSIBLE_VAULT_IDENTITY_LIST variable on your computer) and the vault.yml files in group_vars/ next to the playbooks. In AWX you created the Aurora Store organization (with its Galaxy credential), the Aurora - Gitea (read), Aurora - SSH lab and Aurora - Vault lab credentials, the aurora-infra project, the Aurora - Lab inventory imported from the repository and three templates: Aurora - Configure infrastructure (with limit, tags and verbosity prompted on launch), Aurora - Deploy web (with a survey for aurora_app_version) and Aurora - Check configuration (Check mode with diff, scheduled every night at 06:00). You've read a job's output, relaunched it on the failed hosts, deployed version 1.2.0 and recorded it in the repository after detecting the drift, and launched templates with awx and with the API. In the next lesson, Managing Projects and Inventories, you'll fully understand what happened under the hood: how AWX syncs projects, how it resolves their dependencies and why each adjustment to aurora-infra was necessary, along with all the ways of building inventories in AWX.
Ansible Course: From Beginner to Advanced
Module 1: Introduction to Ansible
- What Is Ansible?
- Installing Ansible
- Setting Up the Practice Lab
- Ansible Architecture
- Basic Ansible Commands
Module 2: Ansible Fundamentals
- Inventory Files
- Inventory Variables: group_vars and host_vars
- Configuring Ansible (ansible.cfg)
- Ad Hoc Commands
- Ansible Modules
- Collections and Fully Qualified Names (FQCN)
Module 3: Playbooks
- Introduction to Playbooks
- Essential YAML for Ansible
- Writing Your First Playbook
- Playbook Structure
- Variables and Facts
- Conditionals and Loops
- Registering Results and Debugging Playbooks
Module 4: Roles
- Introduction to Roles
- Creating Roles
- Role Directory Structure
- Using Roles in Playbooks
- Reusing Tasks: include and import
- Role Dependencies and Argument Validation
Module 5: Advanced Playbook Techniques
- Handlers
- Jinja2 Templates
- Filters and Lookups
- Ansible Vault
- Error Handling
- Tags and Selective Execution
- Rolling Deployments and Delegation
- Optimizing Playbooks
Module 6: Ansible Galaxy
- What Is Ansible Galaxy?
- Using Ansible Galaxy
- Managing Dependencies with requirements.yml
- Creating and Sharing Roles
- Creating Your Own Collections
Module 7: Ansible Tower, AWX and Automation Platform
- Introduction to Ansible Tower and AWX
- Installing AWX
- Using AWX: Job Templates and Jobs
- Managing Projects and Inventories
- Credentials, Permissions (RBAC) and Workflows
- Execution Environments and ansible-navigator
Module 8: Ansible for DevOps
- Ansible and Docker
- Ansible and Kubernetes
- CI/CD with Ansible
- Ansible in Cloud Environments
- Ansible and Terraform
Module 9: Ansible Best Practices
- Code Organization
- Security Best Practices
- Performance Tuning
- Code Quality: ansible-lint and yamllint
- Testing Ansible Code with Molecule
Module 10: Advanced Ansible Topics
- Custom Modules
- Dynamic Inventory
- Ansible Plugins
- The Ansible API and ansible-runner
- Event-Driven Ansible
