Ansible has to know which machines to touch and how to reach them. The inventory lists hosts, groups them (web, db, prod) and holds connection details like ansible_host and ansible_user. You write one before running anything, for example to target only the web servers in prod. When hosts come and go in the cloud, a dynamic inventory that asks the provider by tag beats a hand-kept file.