Inventory

Define and organize managed hosts using static and dynamic inventories.

What Is Inventory?

The inventory defines the hosts and groups that Ansible manages. It can be static or dynamically generated from external systems.

INI Inventory Example


[web]
web01 ansible_host=192.168.1.10
web02 ansible_host=192.168.1.11

[db]
db01 ansible_host=192.168.1.20

YAML Inventory


all:
  children:
    web:
      hosts:
        web01:
        web02:
    db:
      hosts:
        db01:

Group Variables

Variables can be assigned at the group level to reduce duplication and simplify configuration.

Dynamic Inventory

Dynamic inventories integrate with cloud providers and CMDB systems, enabling automatic host discovery.