Junior — Middle
What is the main role of the inventory in Ansible and why is it needed?
sobes.tech AI
Answer from AI
Inventory in Ansible is a list of managed hosts and host groups to which playbooks will be applied. It is used to define target servers, their addresses, and to specify variables specific to each host or group. This allows centralized management of infrastructure and flexible automation configuration.
An example of a simple inventory file (inventory.ini):
[webservers]
web1.example.com
web2.example.com
[dbservers]
db1.example.com
Then, in a playbook, you can specify which groups to apply tasks to.