Writing an Inventory
Learn how to create an inventory file to organize managed nodes.
Writing an Ansible inventory
As we have identified, an Ansible inventory is a file we create to group and manage our managed hosts. Grouping our hosts is very important because different nodes can perform various things, and the configurations to manage them might differ. For example, we can have two groups named “web servers” or “load balancers.”
Press + to interact
We can then write Ansible playbooks or use ad hoc commands to target these host groupings or individual servers. Another use case for an Ansible inventory is defining host-specific or group-specific variables, which we can reference in our playbooks.
Format for writing an inventory
We can write our inventory file in three formats, including: