Ansible AWX Inventory¶
There are several ways you can define and manage inventories in Ansible AWX:
- Static Inventory (via the UI): This involves manually adding groups and hosts through the Ansible AWX dashboard. It's straightforward but tedious.
- From a Project Source: You can also source your inventory from a project from a Git repository based Ansible inventory file.
- Dynamic Inventories: Ansible AWX supports dynamic inventories where the inventory is sourced from external systems like AWS, Google Cloud, Azure, VMware, and more.
Static Inventories¶
When using a static inventory, you add hosts and groups directly via the AWX dashboard:
- Adding Hosts: Hosts represent individual machines, devices, or systems. Each host will have an address (like an IP or hostname) and might also have variables associated with it, providing contextual data or settings specific to that host.
- Organizing with Groups: Groups are collections of hosts.
During this demonstration we will review:
- Creating Hosts
- Adding variables to hosts
- Adding Hosts to location based groups [NYC, SFO]
- Adding Hosts to OS based groups [IOS, JUNOS]
- Adding variables to groups [ntp, snmp]
- Disable devices from inventory
Info
The group_vars all group is associated with the root of the inventory, not a specfic group.

Static Inventories - LAB¶
Add the following the equivalant inventory to your inventory named Static Inventory:
[nyc]
nyc-rt01 operating_system=ios
nyc-rt02 operating_system=ios
[sfo]
sfo-rt01 operating_system=junos
sfo-rt02 operating_system=junos
[ios]
nyc-rt01
nyc-rt02
# cat group_vars/all.yml
ntp_servers:
- 10.1.1.1
- 10.1.1.2
# cat group_vars/nyc.yml
snmp_servers:
- 10.100.100.1
- 10.100.100.2
# cat group_vars/sfo.yml
snmp_servers:
- 10.100.200.1
- 10.100.200.2
Inventory from a Project Source¶
Inventories via the static method can be tedious and error prone. Luckily you can create an inventory from a Git repo.
- Versioning: Every change to the inventory is tracked, allowing for easy rollbacks, audits, and collaboration.
- Consistency: By using a version-controlled inventory across different environments or stages, you ensure consistent configurations.
In this demonstration we will:
- Create an inventory called
Project Inventory - Add a
Source, calledntcu - project - source - Choose the
ntcu [ssh]project - Select the
ansible/lab-inventory/inventoryinventory file - Select Update options
OverwriteandOverwrite Variables

Inventory from a Project Source - Lab¶
In this lab:
- Follow the demo instructions
- Manually remove a host
- Manually update a variable in group vars
- Re-run sync
- What happened?