Search code examples
ansiblekerberosvmwarewinrmvcenter

Is there a way to return the vmware guest.hostName as the ansible_host instead of IP Address


I'm trying to use the vmware_vm_inventory plugin to ansible 2.9 and connecting to a vcenter to get a dynamic inventory. They ansible_host variable is getting populated with my host's ip address and since they are windows host I'm connection to them with winrm and kerberos. Kerberos does not seem to allow IP address and needs the host name. the plugin does return the host name in the variable guest.hostName.

getting errors: "msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS failure. Minor code may provide more information', 851968), ('Server not found in Kerberos database', -1765328377))"

how can I configure ansible and the vmware_vm_inventory plugin to put the host name in the ansible_host variable?


Solution

  • As of Ansible 2.9 the vmware_vm_inventory plugin returns the guest.ipAddress into ansible_host. the module can be modified to use guest.hostName

    feature request here: https://github.com/ansible/ansible/issues/65678