We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Use toolsVersionStatus2 instead of toolsVersionStatus
<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
As i saw in the python module you are looking für toolsVersionStatus instead of toolsVersionStatus2

##### ISSUE TYPE
- Bug Report
- https://developer.vmware.com/apis/1355/
- toolsVersionStatus is depreacated

##### COMPONENT NAME
<!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->
https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_tools_info_module.html#ansible-collections-community-vmware-vmware-guest-tools-info-module

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
Every
```

##### COLLECTION VERSION
<!--- Paste verbatim output from "ansible-galaxy collection list <namespace>.<collection>"  between the quotes
for example: ansible-galaxy collection list community.general
-->
```paste below
https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_tools_info_module.html#ansible-collections-community-vmware-vmware-guest-tools-info-module
```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below

```

##### OS / ENVIRONMENT
<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->


##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- HINT: You can paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- Describe what you expected to happen when running the steps above -->


##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes -->
```paste below

```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugins/modules/vmware_guest_tools_info.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright: (c) 2019, Ansible Project
5 # Copyright: (c) 2019, VMware, Inc. All Rights Reserved.
6 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
7 # SPDX-License-Identifier: GPL-3.0-or-later
8 
9 from __future__ import absolute_import, division, print_function
10 __metaclass__ = type
11 
12 
13 DOCUMENTATION = r'''
14 ---
15 module: vmware_guest_tools_info
16 short_description: Gather info about VMware tools installed in VM
17 description:
18     - Gather information about the VMware tools installed in virtual machine.
19 author:
20     - Diane Wang (@Tomorrow9) <dianew@vmware.com>
21 options:
22    name:
23      description:
24      - Name of the VM to get VMware tools info.
25      - This is required if O(uuid) or O(moid) is not supplied.
26      type: str
27    name_match:
28      description:
29      - If multiple VMs matching the name, use the first or last found.
30      default: 'first'
31      choices: ['first', 'last']
32      type: str
33    uuid:
34      description:
35      - UUID of the instance to manage if known, this is VMware's unique identifier.
36      - This is required if O(name) or O(moid) is not supplied.
37      type: str
38    use_instance_uuid:
39      description:
40      - Whether to use the VMware instance UUID rather than the BIOS UUID.
41      default: false
42      type: bool
43    moid:
44      description:
45      - Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance.
46      - This is required if O(name) or O(uuid) is not supplied.
47      type: str
48    folder:
49      description:
50      - Destination folder, absolute or relative path to find an existing guest.
51      - This is required if name is supplied.
52      - The folder should include the datacenter. ESXi server's datacenter is ha-datacenter.
53      - 'Examples:'
54      - '   folder: /ha-datacenter/vm'
55      - '   folder: ha-datacenter/vm'
56      - '   folder: /datacenter1/vm'
57      - '   folder: datacenter1/vm'
58      - '   folder: /datacenter1/vm/folder1'
59      - '   folder: datacenter1/vm/folder1'
60      - '   folder: /folder1/datacenter1/vm'
61      - '   folder: folder1/datacenter1/vm'
62      - '   folder: /folder1/datacenter1/vm/folder2'
63      type: str
64    datacenter:
65      description:
66      - The datacenter name to which virtual machine belongs to.
67      type: str
68 extends_documentation_fragment:
69 - community.vmware.vmware.documentation
70 
71 '''
72 
73 EXAMPLES = r'''
74 - name: Gather VMware tools info installed in VM specified by uuid
75   community.vmware.vmware_guest_tools_info:
76     hostname: "{{ vcenter_hostname }}"
77     username: "{{ vcenter_username }}"
78     password: "{{ vcenter_password }}"
79     datacenter: "{{ datacenter_name }}"
80     uuid: 421e4592-c069-924d-ce20-7e7533fab926
81   delegate_to: localhost
82   register: vmtools_info
83 
84 - name: Gather VMware tools info installed in VM specified by name
85   community.vmware.vmware_guest_tools_info:
86     hostname: "{{ vcenter_hostname }}"
87     username: "{{ vcenter_username }}"
88     password: "{{ vcenter_password }}"
89     datacenter: "{{ datacenter_name }}"
90     name: "{{ vm_name }}"
91   delegate_to: localhost
92   register: vmtools_info
93 '''
94 
95 RETURN = r'''
96 vmtools_info:
97     description: metadata about the VMware tools installed in virtual machine
98     returned: always
99     type: dict
100     sample: {
101         "vm_uuid": null,
102         "vm_moid": null,
103         "vm_use_instance_uuid": false,
104         "vm_guest_fullname": "Microsoft Windows 10 (64-bit)",
105         "vm_guest_hostname": "test",
106         "vm_guest_id": "windows9_64Guest",
107         "vm_hw_version": "vmx-14",
108         "vm_ipaddress": "10.10.10.10",
109         "vm_name": "test_vm",
110         "vm_tools_install_status": "toolsOk",
111         "vm_tools_install_type": "guestToolsTypeMSI",
112         "vm_tools_last_install_count": 0,
113         "vm_tools_running_status": "guestToolsRunning",
114         "vm_tools_upgrade_policy": "manual",
115         "vm_tools_version": 10341,
116         "vm_tools_version_status": "guestToolsCurrent"
117     }
118 '''
119 
120 
121 from ansible.module_utils.basic import AnsibleModule
122 from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec
123 
124 
125 class PyVmomiHelper(PyVmomi):
126     def __init__(self, module):
127         super(PyVmomiHelper, self).__init__(module)
128         self.name = self.params['name']
129         self.uuid = self.params['uuid']
130         self.moid = self.params['moid']
131         self.use_instance_uuid = self.params['use_instance_uuid']
132 
133     def gather_vmtools_info(self):
134         vmtools_info = dict(
135             vm_name=self.name,
136             vm_uuid=self.uuid,
137             vm_moid=self.moid,
138             vm_use_instance_uuid=self.use_instance_uuid,
139             vm_hw_version=self.current_vm_obj.config.version,
140             vm_guest_id=self.current_vm_obj.summary.guest.guestId,
141             vm_guest_fullname=self.current_vm_obj.summary.guest.guestFullName,
142             vm_guest_hostname=self.current_vm_obj.summary.guest.hostName,
143             vm_ipaddress=self.current_vm_obj.summary.guest.ipAddress,
144             vm_tools_running_status=self.current_vm_obj.summary.guest.toolsRunningStatus,
145             vm_tools_install_status=self.current_vm_obj.summary.guest.toolsStatus,
146             vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus,
147             vm_tools_install_type=self.current_vm_obj.config.tools.toolsInstallType,
148             vm_tools_version=self.current_vm_obj.config.tools.toolsVersion,
149             vm_tools_upgrade_policy=self.current_vm_obj.config.tools.toolsUpgradePolicy,
150             vm_tools_last_install_count=self.current_vm_obj.config.tools.lastInstallInfo.counter,
151         )
152 
153         return {'changed': False, 'failed': False, 'vmtools_info': vmtools_info}
154 
155 
156 def main():
157     argument_spec = vmware_argument_spec()
158     argument_spec.update(
159         name=dict(type='str'),
160         uuid=dict(type='str'),
161         moid=dict(type='str'),
162         use_instance_uuid=dict(type='bool', default=False),
163         name_match=dict(
164             choices=['first', 'last'],
165             default='first',
166             type='str'
167         ),
168         folder=dict(type='str'),
169         datacenter=dict(type='str'),
170     )
171 
172     module = AnsibleModule(
173         argument_spec=argument_spec,
174         required_one_of=[
175             ['name', 'uuid', 'moid']
176         ],
177         mutually_exclusive=[
178             ['name', 'uuid', 'moid']
179         ],
180         supports_check_mode=True,
181     )
182 
183     pyv = PyVmomiHelper(module)
184     vm = pyv.get_vm()
185     if not vm:
186         vm_id = (module.params.get('uuid') or module.params.get('name') or module.params.get('moid'))
187         module.fail_json(msg='Unable to find the specified virtual machine using: %s' % vm_id)
188     results = pyv.gather_vmtools_info()
189     module.exit_json(**results)
190 
191 
192 if __name__ == '__main__':
193     main()
194
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/plugins/modules/vmware_guest_tools_info.py b/plugins/modules/vmware_guest_tools_info.py
--- a/plugins/modules/vmware_guest_tools_info.py
+++ b/plugins/modules/vmware_guest_tools_info.py
@@ -143,13 +143,18 @@
             vm_ipaddress=self.current_vm_obj.summary.guest.ipAddress,
             vm_tools_running_status=self.current_vm_obj.summary.guest.toolsRunningStatus,
             vm_tools_install_status=self.current_vm_obj.summary.guest.toolsStatus,
-            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus,
+            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus2,
             vm_tools_install_type=self.current_vm_obj.config.tools.toolsInstallType,
             vm_tools_version=self.current_vm_obj.config.tools.toolsVersion,
             vm_tools_upgrade_policy=self.current_vm_obj.config.tools.toolsUpgradePolicy,
             vm_tools_last_install_count=self.current_vm_obj.config.tools.lastInstallInfo.counter,
         )
 
+        self.module.deprecate(
+            msg="The API providing vm_tools_install_status has been deprecated by VMware; use vm_tools_running_status / vm_tools_version_status instead",
+            version="5.0.0",
+            collection_name="community.vmware"
+        )
         return {'changed': False, 'failed': False, 'vmtools_info': vmtools_info}

{"golden_diff": "diff --git a/plugins/modules/vmware_guest_tools_info.py b/plugins/modules/vmware_guest_tools_info.py\n--- a/plugins/modules/vmware_guest_tools_info.py\n+++ b/plugins/modules/vmware_guest_tools_info.py\n@@ -143,13 +143,18 @@\n             vm_ipaddress=self.current_vm_obj.summary.guest.ipAddress,\n             vm_tools_running_status=self.current_vm_obj.summary.guest.toolsRunningStatus,\n             vm_tools_install_status=self.current_vm_obj.summary.guest.toolsStatus,\n-            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus,\n+            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus2,\n             vm_tools_install_type=self.current_vm_obj.config.tools.toolsInstallType,\n             vm_tools_version=self.current_vm_obj.config.tools.toolsVersion,\n             vm_tools_upgrade_policy=self.current_vm_obj.config.tools.toolsUpgradePolicy,\n             vm_tools_last_install_count=self.current_vm_obj.config.tools.lastInstallInfo.counter,\n         )\n \n+        self.module.deprecate(\n+            msg=\"The API providing vm_tools_install_status has been deprecated by VMware; use vm_tools_running_status / vm_tools_version_status instead\",\n+            version=\"5.0.0\",\n+            collection_name=\"community.vmware\"\n+        )\n         return {'changed': False, 'failed': False, 'vmtools_info': vmtools_info}\n", "issue": "Use toolsVersionStatus2 instead of toolsVersionStatus\n<!--- Verify first that your issue is not already reported on GitHub -->\r\n<!--- Also test if the latest release and devel branch are affected too -->\r\n<!--- Complete *all* sections as described, this form is processed automatically -->\r\n\r\n##### SUMMARY\r\nAs i saw in the python module you are looking f\u00fcr toolsVersionStatus instead of toolsVersionStatus2\r\n\r\n##### ISSUE TYPE\r\n- Bug Report\r\n- https://developer.vmware.com/apis/1355/\r\n- toolsVersionStatus is depreacated\r\n\r\n##### COMPONENT NAME\r\n<!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->\r\nhttps://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_tools_info_module.html#ansible-collections-community-vmware-vmware-guest-tools-info-module\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\nEvery\r\n```\r\n\r\n##### COLLECTION VERSION\r\n<!--- Paste verbatim output from \"ansible-galaxy collection list <namespace>.<collection>\"  between the quotes\r\nfor example: ansible-galaxy collection list community.general\r\n-->\r\n```paste below\r\nhttps://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_tools_info_module.html#ansible-collections-community-vmware-vmware-guest-tools-info-module\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- Paste verbatim output from \"ansible-config dump --only-changed\" between quotes -->\r\n```paste below\r\n\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->\r\n\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n\r\n```\r\n\r\n<!--- HINT: You can paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- Describe what you expected to happen when running the steps above -->\r\n\r\n\r\n##### ACTUAL RESULTS\r\n<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->\r\n\r\n<!--- Paste verbatim command output between quotes -->\r\n```paste below\r\n\r\n```\r\n\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: (c) 2019, Ansible Project\n# Copyright: (c) 2019, VMware, Inc. All Rights Reserved.\n# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\n\nDOCUMENTATION = r'''\n---\nmodule: vmware_guest_tools_info\nshort_description: Gather info about VMware tools installed in VM\ndescription:\n    - Gather information about the VMware tools installed in virtual machine.\nauthor:\n    - Diane Wang (@Tomorrow9) <dianew@vmware.com>\noptions:\n   name:\n     description:\n     - Name of the VM to get VMware tools info.\n     - This is required if O(uuid) or O(moid) is not supplied.\n     type: str\n   name_match:\n     description:\n     - If multiple VMs matching the name, use the first or last found.\n     default: 'first'\n     choices: ['first', 'last']\n     type: str\n   uuid:\n     description:\n     - UUID of the instance to manage if known, this is VMware's unique identifier.\n     - This is required if O(name) or O(moid) is not supplied.\n     type: str\n   use_instance_uuid:\n     description:\n     - Whether to use the VMware instance UUID rather than the BIOS UUID.\n     default: false\n     type: bool\n   moid:\n     description:\n     - Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance.\n     - This is required if O(name) or O(uuid) is not supplied.\n     type: str\n   folder:\n     description:\n     - Destination folder, absolute or relative path to find an existing guest.\n     - This is required if name is supplied.\n     - The folder should include the datacenter. ESXi server's datacenter is ha-datacenter.\n     - 'Examples:'\n     - '   folder: /ha-datacenter/vm'\n     - '   folder: ha-datacenter/vm'\n     - '   folder: /datacenter1/vm'\n     - '   folder: datacenter1/vm'\n     - '   folder: /datacenter1/vm/folder1'\n     - '   folder: datacenter1/vm/folder1'\n     - '   folder: /folder1/datacenter1/vm'\n     - '   folder: folder1/datacenter1/vm'\n     - '   folder: /folder1/datacenter1/vm/folder2'\n     type: str\n   datacenter:\n     description:\n     - The datacenter name to which virtual machine belongs to.\n     type: str\nextends_documentation_fragment:\n- community.vmware.vmware.documentation\n\n'''\n\nEXAMPLES = r'''\n- name: Gather VMware tools info installed in VM specified by uuid\n  community.vmware.vmware_guest_tools_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    datacenter: \"{{ datacenter_name }}\"\n    uuid: 421e4592-c069-924d-ce20-7e7533fab926\n  delegate_to: localhost\n  register: vmtools_info\n\n- name: Gather VMware tools info installed in VM specified by name\n  community.vmware.vmware_guest_tools_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    datacenter: \"{{ datacenter_name }}\"\n    name: \"{{ vm_name }}\"\n  delegate_to: localhost\n  register: vmtools_info\n'''\n\nRETURN = r'''\nvmtools_info:\n    description: metadata about the VMware tools installed in virtual machine\n    returned: always\n    type: dict\n    sample: {\n        \"vm_uuid\": null,\n        \"vm_moid\": null,\n        \"vm_use_instance_uuid\": false,\n        \"vm_guest_fullname\": \"Microsoft Windows 10 (64-bit)\",\n        \"vm_guest_hostname\": \"test\",\n        \"vm_guest_id\": \"windows9_64Guest\",\n        \"vm_hw_version\": \"vmx-14\",\n        \"vm_ipaddress\": \"10.10.10.10\",\n        \"vm_name\": \"test_vm\",\n        \"vm_tools_install_status\": \"toolsOk\",\n        \"vm_tools_install_type\": \"guestToolsTypeMSI\",\n        \"vm_tools_last_install_count\": 0,\n        \"vm_tools_running_status\": \"guestToolsRunning\",\n        \"vm_tools_upgrade_policy\": \"manual\",\n        \"vm_tools_version\": 10341,\n        \"vm_tools_version_status\": \"guestToolsCurrent\"\n    }\n'''\n\n\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec\n\n\nclass PyVmomiHelper(PyVmomi):\n    def __init__(self, module):\n        super(PyVmomiHelper, self).__init__(module)\n        self.name = self.params['name']\n        self.uuid = self.params['uuid']\n        self.moid = self.params['moid']\n        self.use_instance_uuid = self.params['use_instance_uuid']\n\n    def gather_vmtools_info(self):\n        vmtools_info = dict(\n            vm_name=self.name,\n            vm_uuid=self.uuid,\n            vm_moid=self.moid,\n            vm_use_instance_uuid=self.use_instance_uuid,\n            vm_hw_version=self.current_vm_obj.config.version,\n            vm_guest_id=self.current_vm_obj.summary.guest.guestId,\n            vm_guest_fullname=self.current_vm_obj.summary.guest.guestFullName,\n            vm_guest_hostname=self.current_vm_obj.summary.guest.hostName,\n            vm_ipaddress=self.current_vm_obj.summary.guest.ipAddress,\n            vm_tools_running_status=self.current_vm_obj.summary.guest.toolsRunningStatus,\n            vm_tools_install_status=self.current_vm_obj.summary.guest.toolsStatus,\n            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus,\n            vm_tools_install_type=self.current_vm_obj.config.tools.toolsInstallType,\n            vm_tools_version=self.current_vm_obj.config.tools.toolsVersion,\n            vm_tools_upgrade_policy=self.current_vm_obj.config.tools.toolsUpgradePolicy,\n            vm_tools_last_install_count=self.current_vm_obj.config.tools.lastInstallInfo.counter,\n        )\n\n        return {'changed': False, 'failed': False, 'vmtools_info': vmtools_info}\n\n\ndef main():\n    argument_spec = vmware_argument_spec()\n    argument_spec.update(\n        name=dict(type='str'),\n        uuid=dict(type='str'),\n        moid=dict(type='str'),\n        use_instance_uuid=dict(type='bool', default=False),\n        name_match=dict(\n            choices=['first', 'last'],\n            default='first',\n            type='str'\n        ),\n        folder=dict(type='str'),\n        datacenter=dict(type='str'),\n    )\n\n    module = AnsibleModule(\n        argument_spec=argument_spec,\n        required_one_of=[\n            ['name', 'uuid', 'moid']\n        ],\n        mutually_exclusive=[\n            ['name', 'uuid', 'moid']\n        ],\n        supports_check_mode=True,\n    )\n\n    pyv = PyVmomiHelper(module)\n    vm = pyv.get_vm()\n    if not vm:\n        vm_id = (module.params.get('uuid') or module.params.get('name') or module.params.get('moid'))\n        module.fail_json(msg='Unable to find the specified virtual machine using: %s' % vm_id)\n    results = pyv.gather_vmtools_info()\n    module.exit_json(**results)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/vmware_guest_tools_info.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: (c) 2019, Ansible Project\n# Copyright: (c) 2019, VMware, Inc. All Rights Reserved.\n# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\n\nDOCUMENTATION = r'''\n---\nmodule: vmware_guest_tools_info\nshort_description: Gather info about VMware tools installed in VM\ndescription:\n    - Gather information about the VMware tools installed in virtual machine.\nauthor:\n    - Diane Wang (@Tomorrow9) <dianew@vmware.com>\noptions:\n   name:\n     description:\n     - Name of the VM to get VMware tools info.\n     - This is required if O(uuid) or O(moid) is not supplied.\n     type: str\n   name_match:\n     description:\n     - If multiple VMs matching the name, use the first or last found.\n     default: 'first'\n     choices: ['first', 'last']\n     type: str\n   uuid:\n     description:\n     - UUID of the instance to manage if known, this is VMware's unique identifier.\n     - This is required if O(name) or O(moid) is not supplied.\n     type: str\n   use_instance_uuid:\n     description:\n     - Whether to use the VMware instance UUID rather than the BIOS UUID.\n     default: false\n     type: bool\n   moid:\n     description:\n     - Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance.\n     - This is required if O(name) or O(uuid) is not supplied.\n     type: str\n   folder:\n     description:\n     - Destination folder, absolute or relative path to find an existing guest.\n     - This is required if name is supplied.\n     - The folder should include the datacenter. ESXi server's datacenter is ha-datacenter.\n     - 'Examples:'\n     - '   folder: /ha-datacenter/vm'\n     - '   folder: ha-datacenter/vm'\n     - '   folder: /datacenter1/vm'\n     - '   folder: datacenter1/vm'\n     - '   folder: /datacenter1/vm/folder1'\n     - '   folder: datacenter1/vm/folder1'\n     - '   folder: /folder1/datacenter1/vm'\n     - '   folder: folder1/datacenter1/vm'\n     - '   folder: /folder1/datacenter1/vm/folder2'\n     type: str\n   datacenter:\n     description:\n     - The datacenter name to which virtual machine belongs to.\n     type: str\nextends_documentation_fragment:\n- community.vmware.vmware.documentation\n\n'''\n\nEXAMPLES = r'''\n- name: Gather VMware tools info installed in VM specified by uuid\n  community.vmware.vmware_guest_tools_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    datacenter: \"{{ datacenter_name }}\"\n    uuid: 421e4592-c069-924d-ce20-7e7533fab926\n  delegate_to: localhost\n  register: vmtools_info\n\n- name: Gather VMware tools info installed in VM specified by name\n  community.vmware.vmware_guest_tools_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    datacenter: \"{{ datacenter_name }}\"\n    name: \"{{ vm_name }}\"\n  delegate_to: localhost\n  register: vmtools_info\n'''\n\nRETURN = r'''\nvmtools_info:\n    description: metadata about the VMware tools installed in virtual machine\n    returned: always\n    type: dict\n    sample: {\n        \"vm_uuid\": null,\n        \"vm_moid\": null,\n        \"vm_use_instance_uuid\": false,\n        \"vm_guest_fullname\": \"Microsoft Windows 10 (64-bit)\",\n        \"vm_guest_hostname\": \"test\",\n        \"vm_guest_id\": \"windows9_64Guest\",\n        \"vm_hw_version\": \"vmx-14\",\n        \"vm_ipaddress\": \"10.10.10.10\",\n        \"vm_name\": \"test_vm\",\n        \"vm_tools_install_status\": \"toolsOk\",\n        \"vm_tools_install_type\": \"guestToolsTypeMSI\",\n        \"vm_tools_last_install_count\": 0,\n        \"vm_tools_running_status\": \"guestToolsRunning\",\n        \"vm_tools_upgrade_policy\": \"manual\",\n        \"vm_tools_version\": 10341,\n        \"vm_tools_version_status\": \"guestToolsCurrent\"\n    }\n'''\n\n\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec\n\n\nclass PyVmomiHelper(PyVmomi):\n    def __init__(self, module):\n        super(PyVmomiHelper, self).__init__(module)\n        self.name = self.params['name']\n        self.uuid = self.params['uuid']\n        self.moid = self.params['moid']\n        self.use_instance_uuid = self.params['use_instance_uuid']\n\n    def gather_vmtools_info(self):\n        vmtools_info = dict(\n            vm_name=self.name,\n            vm_uuid=self.uuid,\n            vm_moid=self.moid,\n            vm_use_instance_uuid=self.use_instance_uuid,\n            vm_hw_version=self.current_vm_obj.config.version,\n            vm_guest_id=self.current_vm_obj.summary.guest.guestId,\n            vm_guest_fullname=self.current_vm_obj.summary.guest.guestFullName,\n            vm_guest_hostname=self.current_vm_obj.summary.guest.hostName,\n            vm_ipaddress=self.current_vm_obj.summary.guest.ipAddress,\n            vm_tools_running_status=self.current_vm_obj.summary.guest.toolsRunningStatus,\n            vm_tools_install_status=self.current_vm_obj.summary.guest.toolsStatus,\n            vm_tools_version_status=self.current_vm_obj.summary.guest.toolsVersionStatus2,\n            vm_tools_install_type=self.current_vm_obj.config.tools.toolsInstallType,\n            vm_tools_version=self.current_vm_obj.config.tools.toolsVersion,\n            vm_tools_upgrade_policy=self.current_vm_obj.config.tools.toolsUpgradePolicy,\n            vm_tools_last_install_count=self.current_vm_obj.config.tools.lastInstallInfo.counter,\n        )\n\n        self.module.deprecate(\n            msg=\"The API providing vm_tools_install_status has been deprecated by VMware; use vm_tools_running_status / vm_tools_version_status instead\",\n            version=\"5.0.0\",\n            collection_name=\"community.vmware\"\n        )\n        return {'changed': False, 'failed': False, 'vmtools_info': vmtools_info}\n\n\ndef main():\n    argument_spec = vmware_argument_spec()\n    argument_spec.update(\n        name=dict(type='str'),\n        uuid=dict(type='str'),\n        moid=dict(type='str'),\n        use_instance_uuid=dict(type='bool', default=False),\n        name_match=dict(\n            choices=['first', 'last'],\n            default='first',\n            type='str'\n        ),\n        folder=dict(type='str'),\n        datacenter=dict(type='str'),\n    )\n\n    module = AnsibleModule(\n        argument_spec=argument_spec,\n        required_one_of=[\n            ['name', 'uuid', 'moid']\n        ],\n        mutually_exclusive=[\n            ['name', 'uuid', 'moid']\n        ],\n        supports_check_mode=True,\n    )\n\n    pyv = PyVmomiHelper(module)\n    vm = pyv.get_vm()\n    if not vm:\n        vm_id = (module.params.get('uuid') or module.params.get('name') or module.params.get('moid'))\n        module.fail_json(msg='Unable to find the specified virtual machine using: %s' % vm_id)\n    results = pyv.gather_vmtools_info()\n    module.exit_json(**results)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/vmware_guest_tools_info.py"}]}