Inventory, Modules, and Variables
Once Ansible has a task or set of tasks in a playbook to run, it needs to know where to run those tasks. It needs an inventory of hosts. Ansible has a concept called “inventories” that consist of lists of hosts to perform actions stored in files as YAML.
Ansible inventory files are, by default, stored in
/etc/ansible but can be stored anywhere you choose. In the following example inventory file, you can see that each host is segmented out by categories,
webservers in this case. This grouping allows you to tell Ansible to run tasks on groups of related hosts.