The inventory is the file where you will config the host which will be used for ansible connect via SSH and execute the scripts. Following an example.
[local]
localhost
[webserver]
web.mydomain.com
[databases]
# match hosts in the 10.1.0.0/16
address range 10.1.[0:255].[0:255] [app:children] webserver databases
Following some examples over useful commands regards inventories
- $ ansible [group] –list-hosts: To return the list of hosts in a group.
$ ansible app --list-hosts hosts (2): web.mydomain.com 10.1.[0:255].[0:255]
- ansible –version OR ansible [group] –list-hosts -v: will return the location/path of the configuration file used in the execution of the command when it is performed.
$ ansible app --list-hosts -v Using /home/myused/myansibleproject/ansible.cfg as config file hosts (2): web.mydomain.com 10.1.[0:255].[0:255]
For further information see Configuring Ansible in its documentation.