What is an inventory and why does Ansible need one?

BeginnerConceptInventory
Answer

The inventory is the list of managed hosts, organised into groups, plus the variables attached to them. It answers "which machines does this play touch?" through host patterns like hosts: web.

It can be a static INI/YAML file, a directory of files, or a dynamic source such as the AWS EC2 plugin. Without an inventory, Ansible only knows the implicit localhost.

All Ansible questions Roadmap: Ansible

More on Inventory