Inventory, Modules, and Variables

Learn about the Ansible inventory, modules, and variables in this lesson.

We'll cover the following

Inventory

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, databases, and webservers in this case. This grouping allows you to tell Ansible to run tasks on groups of related hosts.

Get hands-on with 1200+ tech skills courses.