Fredouye / nutanix_ansible

Collection of Ansible roles to manage your Nutanix VMs
6 stars 4 forks source link

inventory_hostname #2

Open erivandosena opened 1 year ago

erivandosena commented 1 year ago

the variable {{ inventory_hostname }} always returns empty, where is it defined?

could you include an example in the README.md ?

Fredouye commented 1 year ago

Hi

inventory_hostname is a special variable : https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html

‘current’ host being iterated over in the play

With this inventory :

[DEV_VMS]
vm1.home.lab
vm2.home.lab

I will add a full example in the README.md When running the playbook, for the first iteration inventory_hostname would be vm1.home.lab, and vm2.home.lab on the second iteration.

erivandosena commented 1 year ago

Thanks for clarifying, an example in the README of how to start the playbook will be very enlightening. ;)