Inventory, Modules, and Variables
Learn about the Ansible inventory, modules, and variables in this lesson.
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.
Press + to interact
[databases]192.168.1.4192.168.1.5192.168.1.6[webservers]192.168.1.10192.168.1.11192.168.1.12
Below, you can see an example of Ansible running a ...