Ansible inventory

An Ansible inventory is the list of managed hosts that Ansible can automate, organized into groups. It can be a static file in INI or YAML format, or a dynamic inventory that pulls hosts from a cloud provider or CMDB. Playbooks target hosts and groups by name from the inventory.

Ansible inventory example (YAML)

all:
  children:
    webservers:
      hosts:
        web1.example.com:
        web2.example.com:
    dbservers:
      hosts:
        db1.example.com:
          ansible_user: admin

Host and group variables can live in the inventory or in host_vars/ and group_vars/ directories. The default inventory path is /etc/ansible/hosts; pass another with -i.