When using the Ansible inventory, hostvars were expected to be found with the ansible_host variable (IP address or whatever), which is not always the case. With a basic inventory, when ansible_host is not defined, the hostname is used. This commit ensures hostvars can be found with the hostname (key) or with the ansible_host variable in the inventory.
When using the Ansible inventory, hostvars were expected to be found with the
ansible_host
variable (IP address or whatever), which is not always the case. With a basic inventory, whenansible_host
is not defined, the hostname is used. This commit ensures hostvars can be found with the hostname (key) or with theansible_host
variable in the inventory.