An inventory file in Ansible is a file that defines the hosts and groups of hosts on which commands, modules, and tasks in a playbook operate. It specifies the machines that Ansible will manage and can include details such as connection methods and variables specific to those hosts.
Typically, an inventory file is structured in a format like INI or YAML, and it can define groups of hosts for better organization. For example:
[local]
localhost ansible_connection=local
[webservers]
web1 ansible_host=192.168.1.10
web2 ansible_host=192.168.1.11
In this example, there are two groups: local and webservers, each containing specific hosts with their connection details.
