VMware: Add ESXi hostname in fact details (#34981)

Fixes: #33972

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/34986/head
Abhijeet Kasurde 7 years ago committed by ansibot
parent 80361ce4da
commit 082654894a

@ -100,6 +100,10 @@ class VmwareVmFacts(PyVmomi):
else: else:
net_dict[device.macAddress]['ipv4'].append(ip_addr) net_dict[device.macAddress]['ipv4'].append(ip_addr)
esxi_hostname = None
if summary.runtime.host:
esxi_hostname = summary.runtime.host.summary.config.name
virtual_machine = { virtual_machine = {
summary.config.name: { summary.config.name: {
"guest_fullname": summary.config.guestFullName, "guest_fullname": summary.config.guestFullName,
@ -108,6 +112,7 @@ class VmwareVmFacts(PyVmomi):
"mac_address": _mac_address, # Kept for backward compatibility "mac_address": _mac_address, # Kept for backward compatibility
"uuid": summary.config.uuid, "uuid": summary.config.uuid,
"vm_network": net_dict, "vm_network": net_dict,
"esxi_hostname": esxi_hostname,
} }
} }

Loading…
Cancel
Save