diff --git a/lib/ansible/modules/cloud/vmware/vmware_cfg_backup.py b/lib/ansible/modules/cloud/vmware/vmware_cfg_backup.py index 224744c488..2b7d343617 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_cfg_backup.py +++ b/lib/ansible/modules/cloud/vmware/vmware_cfg_backup.py @@ -114,7 +114,7 @@ class VMwareConfigurationBackup(PyVmomi): self.module.fail_json(msg="Failed to find ESXi %s" % self.esxi_hostname) host_system = get_all_objs(self.content, [vim.HostSystem]) - return host_system.keys()[0] + return list(host_system)[0] def process_state(self): if self.state == 'saved': diff --git a/lib/ansible/modules/cloud/vmware/vmware_dns_config.py b/lib/ansible/modules/cloud/vmware/vmware_dns_config.py index 8f1032887e..f1834ce1a2 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_dns_config.py +++ b/lib/ansible/modules/cloud/vmware/vmware_dns_config.py @@ -108,7 +108,7 @@ def main(): host = get_all_objs(content, [vim.HostSystem]) if not host: module.fail_json(msg="Unable to locate Physical Host.") - host_system = host.keys()[0] + host_system = list(host)[0] changed = configure_dns(host_system, change_hostname_to, domainname, dns_servers) module.exit_json(changed=changed) except vmodl.RuntimeFault as runtime_fault: diff --git a/lib/ansible/modules/cloud/vmware/vmware_vmkernel_ip_config.py b/lib/ansible/modules/cloud/vmware/vmware_vmkernel_ip_config.py index 669b9308e4..b91bc97683 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vmkernel_ip_config.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vmkernel_ip_config.py @@ -104,7 +104,7 @@ def main(): host = get_all_objs(content, [vim.HostSystem]) if not host: module.fail_json(msg="Unable to locate Physical Host.") - host_system = host.keys()[0] + host_system = list(host)[0] changed = configure_vmkernel_ip_address(host_system, vmk_name, ip_address, subnet_mask) module.exit_json(changed=changed) except vmodl.RuntimeFault as runtime_fault: diff --git a/lib/ansible/modules/cloud/vmware/vmware_vsan_cluster.py b/lib/ansible/modules/cloud/vmware/vmware_vsan_cluster.py index 223f251acb..15d50a8479 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vsan_cluster.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vsan_cluster.py @@ -108,7 +108,7 @@ def main(): host = get_all_objs(content, [vim.HostSystem]) if not host: module.fail_json(msg="Unable to locate Physical Host.") - host_system = host.keys()[0] + host_system = list(host)[0] changed, result, cluster_uuid = create_vsan_cluster(host_system, new_cluster_uuid) module.exit_json(changed=changed, result=result, cluster_uuid=cluster_uuid)