By default, Ansible has a file on /etc/Ansible/hosts containing a hostname or IP address of the targeted system. The inventory file can be specified with the help of -I option on the command line. Ansible actively selects the segment of hosts to work from this inventory file. This file can be in YAML or INI format. In the inventory file host and group, variables are defined and it is easy to assign these variables to host for later utilization.

Note: This is one of the frequently asked Ansible interview questions.

Suggest An Answer

No suggestions Available!