Building an Inventory
An inventory defines a collection of hosts that Ansible manages. These hosts can also be assigned to groups, which can be managed collectively. Groups can contain child groups, and hosts can be members of multiple groups. The inventory can also set variables that apply to the hosts and groups that it defines.
There are two ways to define host inventories. Use a text file to define a static host inventory. Use an Ansible plig-in to generate a dynamic host inventory as needed, using external information providers.
These are a list of hostnames or ips they can be organiced in groups group use [] to identify themselves. Groups can hold other groups (children) A host can belong to many groups
Two host groups always exist: The all host group contains every host explicitly listed in the inventory. The ungrouped host group contains every host explicitly listed in the inventory that is not a member of any other group.
Verifying Inventory
use following command to check if a machine is in the inventory
[user@controlnode ~]$ ansible-navigator inventory -m stdout \ > --host washington1.example.com
this command lists all hosts in the inventory
[user@controlnode ~]$ ansible-navigator inventory -m stdout --list
to see all hosts in a group use
[user@controlnode ~]$ ansible-navigator inventory -m stdout --graph canada
you can also use the
ansible-navigator inventory
command to brownse interactively the inventory
Your ansible-navigator inventory command must include the -i option to specify the location of your inventory file