[Ansible] – Inventories

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.



# match hosts in the 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):
  • 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):

For further information see Configuring Ansible in its documentation.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s