How to make your ansible inventory ?

Ansible is capable of working with one host or multiple hosts at the same time. But for multiple hosts its required to create a group of hosts. A file can be created to define a host or a group of hosts known as inventory. The default location of inventory is a file called ' /etc/ansible/hosts '. But you can create the inventory file with any name and can call it using -i <path-to-inventory-file> while running the playbooks. Ansible inventory file can be created using YAML or INI format. INI is the most common format and have better control while working with large number of groups. More information are available in inventory documentation. If there is a need to assign some specific variable or some common variable to a group of hosts, it can be easily done using inventory file. Let's discus this using an example. Let say you need to deploy 2 linux vms in vSphere platform and you have the following folder structure to keep your playbooks in terms of ansible roles, ...