Inventories Done Right: From Static Hosts to Dynamic Cloud Discovery
Creating Your First Inventory
To add a host, you need an inventory first. Open the Inventories menu from the left sidebar and click Add. Three types appear:
- Inventory
- Smart Inventory
- Constructed Inventory
Standard Inventory: The Default Choice
A static list of hosts you define manually. The simplest type and what you'll use most. An inventory holds two things:
- Hosts: the machines AWX runs playbooks against. Each has a name, an address, and optional variables.
- Groups: a way to bundle hosts (
web,db,production). A host can belong to multiple groups. Groups can carry variables that apply to all their member hosts.
Structure:
Inventory
├── Hosts
│ ├── Host1
│ ├── Host2
│ └── Host3
└── Groups
├── web
│ ├── Host1
│ └── Host2
└── db
└── Host3
Smart Inventory: Why You Shouldn't Use It
A virtual inventory built from a host filter applied across all hosts in an organization. For example, a filter like name__icontains=web returns every host whose name contains "web," regardless of which inventory it lives in.
Smart Inventory is deprecated and scheduled for removal in a future AWX release. The AWX docs direct users to migrate to Constructed Inventory. Don't build new automation on Smart Inventory.
Constructed Inventory: The Modern Replacement
The replacement for Smart Inventory. Takes one or more input inventories and uses Ansible's ansible.builtin.constructed inventory plugin to produce a new one. It can:
- Filter hosts based on hostvars, group membership, or facts.
- Build new groups dynamically using Jinja2 expressions.
- Compose hostvars from input inventories with full namespace support.
Constructed Inventory is more powerful than Smart Inventory because it gives you the full Ansible hostvars namespace and lets you create groups, not just filter hosts. We'll cover it in detail later in this chapter.
Whichever type you create, the structure underneath is the same: an inventory contains groups, which contain hosts.
Inventory Structure
We're going to proceed with the regular inventory (first type). Click on the Inventory button and provide a name. Let's call it NebulaInventory. Create a second one called SolaraInventory.
You can add labels to each inventory. Labels are tags used to group and filter inventories. For example, you can create a production label and assign it to every inventory used in production, or a staging label for staging environments. We're not going to use labels in this example.
Assign each inventory to its respective organization.
When you create inventories, you can also add variables to them. These work like the variables defined in an Ansible inventory file and can be used to set common defaults for every host. For our example, let's define ansible_user to set the default SSH user.
---
ansible_user: root
Create Inventory
Our two inventories are created. Now we can start adding hosts. Since we have two managed machines, each one goes into its matching inventory. Click on the inventory you want to add a host to and then click on the Hosts
AWX in Action
Ansible Orchestration at ScaleEnroll now to unlock all content and receive all future updates for free.


