In the previous lesson you created the aurora-infra project and the Aurora - Lab inventory, filling in only the essential fields, and you made a few adjustments to the repository that were explained only in passing: moving the dependencies to roles/requirements.yml and collections/requirements.yml, publishing the nginx role on Gitea and moving the Vault files out of the inventory. Everything worked, but an AWX administrator needs to understand why. In this lesson you'll study in depth the two objects that feed any job template: projects, that is, how AWX fetches code from Git, how it handles branches and versions and how it installs dependencies (which will fully close the Module 6 warning about git+file://), and inventories, in all their forms: manual, imported from the project, constructed and dynamic. You'll finish with a clear recommendation on where Aurora's groups and variables should live.

Contents

  1. The project in AWX: what it is and how it's synced
  2. The fields of a project
  3. Branches, tags and commits
  4. Dependencies: how AWX processes requirements.yml
  5. The Module 6 warning, resolved
  6. Inventory types in AWX
  7. Manual inventories
  8. Inventories from the project
  9. Vault and inventory import
  10. Groups and variables: in AWX or in the repository?
  11. Constructed inventories (and the old smart ones)
  12. Dynamic cloud inventories
  13. When each thing is synced

  1. The project in AWX: what it is and how it's synced

A project is AWX's representation of a repository with playbooks. AWX never runs code directly from Git: first it syncs it (project update), that is, it clones or updates it in its storage, installs its dependencies and keeps a copy per revision. Job templates always run from that copy.

flowchart LR
    G[(Gitea<br/>ops/aurora-infra)] -->|1. git clone / fetch<br/>with the SCM credential| C[Copy of the project<br/>in AWX]
    C -->|2. roles/requirements.yml| R[Roles in the cache<br/>for that revision]
    C -->|3. collections/requirements.yml| CO[Collections in the cache<br/>for that revision]
    C --> J[Job]
    R --> J
    CO --> J
    J -->|copies everything to<br/>the EE container| E[Run]

The sync is itself a job of type Project Update (you saw it in Lesson 7.3), with its own output, status and place in the history. It runs:

  • when the project is created;
  • manually, with the sync button;
  • before every job, if the project has Update Revision on Launch;
  • on a schedule (the project's Schedules tab);
  • as a workflow node (Lesson 7.5).

The synced revision (the commit hash) is recorded in the project and in every job, so you'll always know exactly which code was run.

  1. The fields of a project

Field / option What it's for At Aurora
Source Control Type Where the code comes from: Git (the usual choice), Subversion, Remote Archive (a downloadable .tar.gz or .zip), Red Hat Insights or Manual (a directory on the AWX server; impractical on Kubernetes) Git
Source Control URL The repository address. Accepts https://, http://, ssh:// and the git@server:path.git form http://git.aurora-store.example/ops/aurora-infra.git
Source Control Branch/Tag/Commit Which branch, tag or commit is synced (empty = default branch) main
Source Control Refspec Additional refspec to fetch special references (for example, those of pull requests) Empty
Source Control Credential Credential for cloning: username and password or token (HTTP/HTTPS), or SSH key Aurora - Gitea (read)
Clean Discards local changes in the copy before updating Optional
Delete Deletes the copy and clones from scratch on every sync (slower, useful if the copy gets corrupted) No
Track submodules Updates Git submodules to their latest version No (no submodules)
Update Revision on Launch Syncs before every job so the latest commit is used Yes
Cache Timeout With the previous option, the number of seconds during which a recent sync is reused instead of being repeated 0 in the lab; a few seconds or minutes if many jobs are launched in a row
Allow Branch Override Lets a template use another branch of the same repository Yes (section 3)
Execution Environment Environment in which the sync runs and, by default, the project's jobs Empty until Lesson 7.6

A good practice is to use one project per repository and per code "line": if one day Aurora has production pinned to tags and the lab following main, those will be two different projects on the same repository (for example, aurora-infra and aurora-infra (production) with Branch = a tag such as 2026.12.01). That way each template makes it clear which code it runs.

  1. Branches, tags and commits

A project following main always runs the latest code that's been merged. What if you want to test a change on a branch before merging it? With Allow Branch Override on the project, templates show a new field, Source Control Branch, which can be set or prompted on launch.

Try it. Edit the aurora-infra project and check Allow Branch Override. In Aurora - Check configuration, check Prompt on launch on Source Control Branch. Then, on your computer, create a branch with a harmless change:

cd ~/aurora-infra
git switch -c test-motd

In the roles/common/templates/motd.j2 template, add a line Usage policy: authorized personnel only. at the end, and push the branch:

git commit -am "Test: usage notice in the motd"
git push -u origin test-motd

Launch Aurora - Check configuration with Source Control Branch = test-motd. The job shows the motd diff on all four servers without applying anything: you've tested a branch from the platform, with the real credentials and environment, without touching main. In Details you'll see the branch and revision used.

Watch out: the template's branch affects the project's playbooks, roles and templates, but not the inventory. The imported inventory comes from the sync of its source, which uses the branch configured in the project (main). If on that branch you had changed, for example, common_organization in inventory/group_vars/all/common.yml, the job would not show that change. It's a subtlety that confuses many teams. To test inventory changes on a branch, create a temporary project and inventory source that point to that branch (Exercise 1), or test the branch in your terminal.

When you're done, delete the branch (it doesn't get merged):

git switch main
git branch -D test-motd
git push origin --delete test-motd

Besides branches, the Branch/Tag/Commit field accepts tags (1.0.0) and commit hashes. Pinning a project to a tag is the way to freeze exactly which code runs in a sensitive environment.

  1. Dependencies: how AWX processes requirements.yml

At the end of each sync, AWX looks for two files at fixed paths in the project:

File What AWX runs Where it installs
roles/requirements.yml ansible-galaxy role install -r roles/requirements.yml A role cache tied to the project revision
collections/requirements.yml ansible-galaxy collection install -r collections/requirements.yml A collection cache tied to the revision

Important details:

  • Fixed paths and separate files. A requirements.yml at the root (like the one from Lesson 6.3) isn't processed, and a roles file with a collections: section doesn't install those collections. That's why you split the file in Lesson 7.3.
  • Per-revision cache. Dependencies are installed when the sync brings in a new revision (or when you force it). If you change a role's version in roles/requirements.yml, the new commit triggers the reinstallation on the next sync.
  • How the job finds them. AWX copies those caches into the job's container and sets ANSIBLE_ROLES_PATH and ANSIBLE_COLLECTIONS_PATH so they point to them first. Environment variables take precedence over ansible.cfg (Lesson 2.3), so in AWX your roles_path = galaxy_roles:roles and collections_path = collections play no part. Your own roles (common, postgresql, aurora_app) are still found because they're in roles/ next to the playbooks, which Ansible always checks.
  • Galaxy credentials per organization. Downloads from Galaxy, Automation Hub or a private server use the Galaxy Credentials of the project's organization, in the order in which they're listed (Lesson 7.3). It's AWX's equivalent of the [galaxy] server_list from Lesson 6.3: without them, the requirements files aren't processed.
  • Global switches. AWX's job settings include options to enable or disable downloading roles and collections. They're enabled by default; if one day the requirements are "ignored" with no error, check them.
  • Priority over the execution environment. If the execution environment already contains a collection (Lesson 7.6) and the project also declares it, the project's one wins, because its cache comes first in the path.

In your terminal, the equivalent with the two files is:

cd ~/aurora-infra
ansible-galaxy role install -r roles/requirements.yml            # -> galaxy_roles/
ansible-galaxy collection install -r collections/requirements.yml  # -> collections/ansible_collections/

  1. The Module 6 warning, resolved

At the end of Module 6, requirements.yml downloaded the nginx role like this:

  - name: nginx
    src: git+file:///home/student/aurora-git/ansible-role-nginx.git
    version: "1.0.0"

If you had created the project with that line (in roles/requirements.yml), the sync would have failed with an error similar to:

[WARNING]: - nginx was NOT installed successfully: - command /usr/bin/git clone
/home/student/aurora-git/ansible-role-nginx.git nginx failed ...
fatal: repository '/home/student/aurora-git/ansible-role-nginx.git' does not exist
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.

The cause: ansible-galaxy runs inside an AWX container, where /home/student doesn't exist. A file:// URL only works on the machine where the file is. The options for solving it:

Option How Advantages Drawbacks
A. Reachable Git server, repository freely readable on the internal network git+http(s)://git.aurora-store.example/ops/ansible-role-nginx.git Simple; works the same in AWX, in your terminal and in continuous integration; no secrets The repository can be read by anyone with access to the internal network
B. Private repository over HTTPS with credentials in the URL https://user:token@... Private repository The token ends up written in the repository: unacceptable
C. Private repository over SSH [email protected]:ops/ansible-role-nginx.git Private repository Requires the installing environment to have a valid SSH key and the server's fingerprint; harder to maintain in AWX and in continuous integration
D. Distribute the role inside a collection on a content server (Galaxy NG, Private Automation Hub) collections/requirements.yml with the collection, token in an organization Galaxy credential The most professional option: versioned, immutable artifacts, credentials managed by AWX Requires setting up and maintaining that server

Aurora's decision: option A. ansible-role-nginx is a public repository within the internal Gitea (it contains no secrets and isn't reachable from the Internet), and roles/requirements.yml downloads it over http:// in the lab (https:// in the company). If Aurora ends up with several consuming teams, the natural next step is option D with the aurora_store.infra collection (Lesson 6.5).

With this decision, the cycle for publishing a new version of the role looks like this:

sequenceDiagram
    participant R as ~/ansible-role-nginx
    participant G as Gitea
    participant A as ~/aurora-infra
    participant X as AWX
    R->>R: change + CHANGELOG + git tag -a 1.1.0
    R->>G: git push origin main --tags
    A->>A: roles/requirements.yml: version "1.1.0"
    A->>A: ansible-galaxy role install -r roles/requirements.yml --force<br/>and test in the lab
    A->>G: git push (commit with the version change)
    X->>G: sync (Update Revision on Launch)
    X->>X: new revision: reinstalls nginx 1.1.0

  1. Inventory types in AWX

Type Contents Typical use
Regular inventory Hosts and groups created by hand, imported from sources, or both The general case. Aurora - Lab is of this type, with one source
Constructed inventory Built from one or more existing inventories, with the constructed plugin (groups computed with expressions) Cross-cutting views: "all Ubuntu servers", "frontends across all environments"
Smart inventory (old) Host filter over all the organization's inventories Replaced by constructed inventories; may appear in older installations

A regular inventory can have several sources: the project, clouds (AWS, Azure, Google Cloud, VMware…), Red Hat Satellite, OpenStack and others. Each source is a small job of type Inventory Update that runs ansible-inventory and loads the result into the AWX database.

  1. Manual inventories

In any regular inventory you can create hosts and groups from the interface (Hosts → Add, Groups → Add) with their variables in YAML or JSON. It's useful for tests or for small inventories nobody else needs, but it has the drawbacks of everything done with the mouse: no Git history, no review through pull requests, and it can't be used from your terminal.

For example, to run one-off tests against awx1 (which is deliberately not in Aurora's inventory), you could create a Lab - Services inventory with a single host:

# Variables of the awx1 host in the manual inventory (Variables field)
ansible_host: 192.168.56.30

Aurora's recommendation: manual inventories only for throwaway tests. Everything that manages the store's servers lives in the repository.

  1. Inventories from the project

The Sourced from a Project source imports an inventory that lives inside a project. Its fields:

Field Meaning At Aurora
Project The project the inventory comes from aurora-infra
Inventory file File or directory inside the project: a static inventory (INI/YAML), an inventory directory or an inventory plugin configuration file inventory/
Credential Credential for plugins that need one (for example, a cloud's) —
Verbosity Level of detail of the sync output 1
Host Filter Regular expression to import only some hosts —
Enabled Variable / Enabled Value Variable that marks a host as enabled or disabled —
Overwrite Remove from AWX the hosts and groups that are no longer in the source Yes
Overwrite variables Replace the AWX variables with the source's (without this option, they're merged) Yes
Update on launch Sync the source before every job that uses the inventory Yes
Cache Timeout Reuse a recent sync for this many seconds 0 in the lab

When you choose the inventory/ directory, the import includes hosts.yml and the variables from that directory's group_vars/ and host_vars/. AWX essentially does the same as this command, which you can run on your computer to see in advance what will be imported:

cd ~/aurora-infra
ansible-inventory -i inventory --list --export | head -40
{
    "_meta": {
        "hostvars": {
            "db1": {
                "ansible_host": "192.168.56.21",
                ...
                "postgresql_shared_buffers": "512MB",
                ...
  • --list produces the full inventory in JSON.
  • --export keeps the variables unevaluated (the {{ ... }} expressions remain as text), just as AWX stores them. They're evaluated later, when each job runs, once the facts, hostvars and the group_vars/ variables next to the playbooks exist.

One consequence worth being clear about: in AWX, Ansible doesn't read inventory/group_vars/ at run time. The job receives the inventory exported from the AWX database, not the directory. What's in inventory/ reaches the jobs only through the import. That's why it's essential for the source to be synced when the repository changes (Update on launch), and that's why you checked it in Lesson 7.3 when changing aurora_app_version. On the other hand, group_vars/ and host_vars/ next to the playbooks are read on every run, because they're part of the project.

  1. Vault and inventory import

Now the last adjustment from Lesson 7.3 makes sense. Syncing an inventory source runs ansible-inventory, which needs to read inventory/group_vars/all/vault.yml to import its variables. But AWX inventory sources don't accept Vault credentials: it's a known limitation, and the sync fails with:

ERROR! Attempting to decrypt but no vault secrets found

The usual solutions:

Option Description Assessment
Encrypted files next to the playbooks group_vars/<group>/vault.yml at the project root: they're not part of the import and are decrypted at run time, with the template's Vault credential Chosen by Aurora: no extra tools, works the same in your terminal
Secrets in AWX credentials Create a custom credential type that injects the variables (Lesson 7.5) Good for secrets only AWX uses, but the secret is no longer in the repository and your terminal needs another way to get it
External secrets manager AWX queries HashiCorp Vault, CyberArk or others through credential lookups The enterprise option; requires that manager
Vault password inside a custom execution environment Use that EE in the inventory source Not recommended: the password ends up inside an image

The resulting layout of Aurora's secrets is:

aurora-infra/
├── group_vars/                  ← next to the playbooks: encrypted secrets (not imported)
│   ├── all/vault.yml            (vault_aurora_db_password)
│   └── dbservers/vault.yml      (vault_aurora_reporting_db_password)
└── inventory/                   ← imported into AWX: nothing encrypted
    ├── hosts.yml
    ├── group_vars/all/{aurora.yml, common.yml, team.yml, monitoring.yml}
    ├── group_vars/dbservers/vars.yml   (uses "{{ vault_aurora_reporting_db_password }}")
    ├── group_vars/loadbalancers.yml
    ├── group_vars/webservers.yml
    └── host_vars/{db1.yml, web1.yml, web2.yml}

The vault.yml + vars.yml pattern from Lesson 5.4 is kept: the names the roles use are in the inventory and reference the encrypted vault_ variables, which now live next to the playbooks. Two side effects to remember: ad hoc commands (ansible) don't read the playbooks' group_vars/, and ansible-inventory --host db1 doesn't show them either unless you add --playbook-dir .. Neither of them needed the secrets.

  1. Groups and variables: in AWX or in the repository?

AWX lets you edit variables at several levels (inventory, group, host, template, survey), and it's tempting to "make a quick fix" from the interface. Compare:

Criterion Variables in the repository Variables edited in AWX
History and review Git: who, when, why, pull requests Activity Stream (records the change, but with no prior review)
Available in your terminal, in CI and in tests Yes No
Reproducible in another AWX installation Yes Only if you export the AWX configuration
Persistence with Overwrite variables — Lost on the next sync if they're on imported groups or hosts
Suitable for Everything that describes the infrastructure What depends on the run: survey answers, variables for a specific template, credentials

Aurora's recommendation: the repository is the source of truth. Hosts, groups and variables live in inventory/ and are imported with Overwrite and Overwrite variables; in AWX, only run-specific variables are defined (surveys, such as aurora_app_version, which are then recorded in Git) along with the credentials' secrets. If someone edits a variable on an imported group by hand, the next sync will overwrite it: that's the desired behavior.

  1. Constructed inventories (and the old smart ones)

A constructed inventory takes one or more input inventories and applies the ansible.builtin.constructed plugin to them to create computed groups. It's used to get views that don't exist as a group in the repository, without touching it.

Example: Aurora wants a template that acts on all the frontends (load balancers and web servers), for example to review their firewalls. Inventories → Add → Add constructed inventory:

Field Value
Name Aurora - Frontends
Organization Aurora Store
Input Inventories Aurora - Lab
Limit frontends
Source vars (see below)
plugin: ansible.builtin.constructed
strict: true
groups:
  frontends: "'webservers' in group_names or 'loadbalancers' in group_names"
  • groups: defines new groups: each key is a group name and its value is a Jinja2 expression evaluated for each host; if it's true, the host joins the group.
  • group_names is the magic variable with the host's groups (Lesson 3.5).
  • strict: true makes an error in an expression fail the sync instead of being ignored.
  • Limit frontends makes the resulting inventory contain only those hosts.

Once synced, it contains lb1, web1 and web2, with all their original variables and groups plus the frontends group. If web3 is added to the repository tomorrow, it will show up here without touching anything.

The old smart inventories did something similar with a host filter (for example, groups__name=webservers), but they could only filter, not compute groups or variables. In new installations, use constructed.

  1. Dynamic cloud inventories

When servers are created and destroyed in a cloud, maintaining hosts.yml by hand isn't viable. AWX comes with inventory sources for the main providers (Amazon EC2, Microsoft Azure Resource Manager, Google Compute Engine, VMware vCenter, OpenStack, Red Hat Satellite and others), which use the inventory plugins from their collections and a cloud credential (Lesson 7.5). Each sync queries the provider's API and imports the existing machines, grouped by tags, regions or types.

You can also use an inventory plugin with a configuration file stored in the project (for example, inventory/aws_ec2.yml) as a Sourced from a Project source. Dynamic inventories are covered in Lesson 10.2, and their use with clouds in 8.4.

  1. When each thing is synced

With several "update on launch" options, it's worth being clear about the order. When you launch Aurora - Configure infrastructure:

flowchart TB
    L[Launch template] --> P{Project with<br/>Update Revision on Launch?}
    P -->|Yes, and the cache has expired| PU[Project Update<br/>git + requirements]
    P -->|No| I
    PU --> I{Inventory source with<br/>Update on launch?}
    I -->|Yes, and the cache has expired| IU[Inventory Update<br/>ansible-inventory --export]
    I -->|No| J
    IU --> J[Job: ansible-playbook<br/>with the project revision<br/>and the imported inventory]

Summary of mechanisms:

Mechanism Project Inventory source
On creation Yes No (Sync button)
Manual Sync button Sync button
Before every job Update Revision on Launch Update on launch
Reusing a recent sync Cache Timeout Cache Timeout
Periodic Schedules tab The source's Schedules tab
In a workflow Project Sync node Inventory Source Sync node

Failed syncs show up in Views → Jobs like any other job (types Project Update and Inventory Update), and their output is the first place to look when a job uses old code or variables.

Common Mistakes and Tips

  • Changing an inventory file in Git and not seeing it in AWX: the source hasn't been synced. Enable Update on launch or sync it by hand.
  • Testing a branch with Allow Branch Override and expecting to see changes in inventory/: the inventory comes from the project's branch, not the template's.
  • Leaving a requirements.yml only at the root: AWX doesn't process it. Use roles/requirements.yml and collections/requirements.yml.
  • An organization without a Galaxy credential: the sync finishes without installing dependencies, and the job then fails because of roles or modules it can't find.
  • Writing tokens into the URLs in requirements.yml: they stay in the Git history forever. Use repositories readable on the internal network, SSH with managed keys, or a content server with AWX credentials.
  • Encrypted files in inventory/: the inventory sync fails because it can't decrypt them.
  • Editing variables of imported groups in the interface: they disappear on the next sync with Overwrite variables.
  • Tip: before pushing an inventory change, run ansible-inventory -i inventory --list --export on your computer. If it fails there, it will fail in AWX.

Exercises

Exercise 1: A new host, end to end

Without running anything against servers, add a fictitious host web3 (192.168.56.13) to the webservers group on a test-web3 branch. What would you have to do to see it in an AWX inventory without merging it into main? Do it, and then undo everything.

Exercise 2: Constructed inventory by role

Create a constructed inventory Aurora - By role that adds the groups with_postgresql (hosts in the dbservers group) and with_nginx (hosts in webservers or loadbalancers), with no Limit. Check the result. What would happen with strict: true if you misspelled a variable name in an expression?

Exercise 3: Troubleshooting

Marc changes the nginx_worker_connections variable of the webservers group to 2048 in the AWX interface to run a quick test. The next day, the value is back to 1024 and nobody has touched it. Explain what happened and what the right way to run that test would be.

Solutions

Exercise 1. On your computer:

cd ~/aurora-infra
git switch -c test-web3

Add web3 with ansible_host: 192.168.56.13 under webservers in inventory/hosts.yml, commit it and run git push -u origin test-web3. In AWX, since the inventory comes from the project's branch, you need a temporary project aurora-infra (test-web3) with Branch test-web3 (and the same credential) and a temporary inventory with a source from that project and Inventory file inventory/. When you sync it, lb1, web1, web2, web3 and db1 appear. To undo it: delete the temporary inventory and project in AWX, and in Git run git switch main, git branch -D test-web3 and git push origin --delete test-web3.

Exercise 2. Input Inventories: Aurora - Lab; Source vars:

plugin: ansible.builtin.constructed
strict: true
groups:
  with_postgresql: "'dbservers' in group_names"
  with_nginx: "'webservers' in group_names or 'loadbalancers' in group_names"

After syncing: with_postgresql = db1; with_nginx = lb1, web1, web2. With strict: true, a misspelled variable (for example group_name) produces an undefined variable error and the sync fails, which alerts you immediately. With strict: false, the failing expression is silently ignored and the group simply ends up empty, a much harder error to detect.

Exercise 3. The aurora-infra repository source has Overwrite variables and Update on launch: the next time a template using that inventory was launched (for example, the 06:00 nightly check), the import replaced the group's variables with those in the repository, where the value is still 1024. That's the desired behavior: the repository is the source of truth. The right way to test it: on a branch, change the value in inventory/group_vars/webservers.yml and test it from your terminal with --check --diff --limit web1; or, for a one-off test in AWX, pass -e nginx_worker_connections=2048 as an extra variable in a check template (without modifying the inventory). If the test goes well, the change is merged into main with its commit.

Conclusion

You now understand what happens under the hood of every AWX job. A project is synced from Git (URL, branch, tag or commit, SCM credential, Update Revision on Launch, Cache Timeout, Allow Branch Override) and, on each new revision, installs its dependencies from two fixed paths, roles/requirements.yml and collections/requirements.yml, using the organization's Galaxy credentials. With that you've closed the Module 6 warning: the nginx role is no longer downloaded from git+file:///home/student/..., which doesn't exist inside the container, but from the internal Gitea (git.aurora-store.example/ops/ansible-role-nginx, freely readable on the internal network), and you know the cycle for publishing new versions of the role. As for inventories, you know how to create them by hand, import them from the project (with Overwrite, Overwrite variables and Update on launch), compute views with constructed inventories and where dynamic cloud sources fit in; you know that, in AWX, inventory/group_vars/ only reaches the jobs through the import, and why Aurora's encrypted secrets live in group_vars/ next to the playbooks. And you've set the rule: the repository is the source of truth for hosts, groups and variables. But so far you've done everything as admin, and any user with access would see everything and be able to launch it. In the next lesson, Credentials, Permissions (RBAC) and Workflows, you'll study credentials in depth, give each person at Aurora only the permissions they need and chain a check, an approval and a deployment into a workflow.

Ansible Course: From Beginner to Advanced

Module 1: Introduction to Ansible

Module 2: Ansible Fundamentals

Module 3: Playbooks

Module 4: Roles

Module 5: Advanced Playbook Techniques

Module 6: Ansible Galaxy

Module 7: Ansible Tower, AWX and Automation Platform

Module 8: Ansible for DevOps

Module 9: Ansible Best Practices

Module 10: Advanced Ansible Topics

Module 11: Final Project

© Copyright 2026. All rights reserved