The inventory file format for Ansible can be in either INI or YAML format.
INI Format
In the INI format, the inventory file consists of sections defined by square brackets, with hosts listed under each section. For example:
[webservers]
server1.example.com
server2.example.com
[databases]
db1.example.com
db2.example.com
YAML Format
In the YAML format, the inventory file is structured using key-value pairs and lists. For example:
all:
hosts:
server1.example.com:
server2.example.com:
children:
webservers:
hosts:
server1.example.com:
server2.example.com:
databases:
hosts:
db1.example.com:
db2.example.com:
Both formats can be used to define hosts and groups for Ansible playbooks and commands.
