We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid return type for vmware_vsan_health_info
<!--- Verify first that your improvement 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
<!--- Explain the problem briefly below, add suggestions to wording or structure -->

The documentation for vmware_vsan_health_info states that the [return type is dict](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L66) but the response is wrapped into a `json.dumps` [converting it to string](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L168). I am uncertain whether the return type documentation or the returned object should be adapted, but the current inconsistency should be fixed.

<!--- HINT: Did you know the documentation has an "Edit on GitHub" link on every page ? -->

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME
<!--- Write the short name of the rst file, module, plugin, task or feature below, use your best guess if unsure -->
vmware_vsan_health_info

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible [core 2.14.2]
  config file = None
  configured module search path = ['/var/home/philipp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /var/home/philipp/.local/pipx/venvs/ansible-core/lib64/python3.11/site-packages/ansible
  ansible collection location = /var/home/philipp/.ansible/collections:/usr/share/ansible/collections
  executable location = /var/home/philipp/.local/bin/ansible
  python version = 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/var/home/philipp/.local/pipx/venvs/ansible-core/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


--- 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_vsan_health_info.py`
Content:
```
1 #!/usr/bin/python
2 
3 # Copyright: (c) 2019, OVH SAS
4 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6 
7 from __future__ import absolute_import, division, print_function
8 __metaclass__ = type
9 
10 
11 DOCUMENTATION = r'''
12 ---
13 module: vmware_vsan_health_info
14 short_description: Gather information about a VMware vSAN cluster's health
15 description:
16     - "Gather information about a VMware vSAN cluster's health."
17 options:
18     datacenter:
19         description:
20             - Name of the Datacenter.
21         required: false
22         type: str
23         aliases: [ 'datacenter_name' ]
24     cluster_name:
25         description:
26             - Name of the vSAN cluster.
27         required: true
28         type: str
29     fetch_from_cache:
30         description:
31             - C(true) to return the result from cache directly instead of running the full health check.
32         required: false
33         default: false
34         type: bool
35 requirements:
36     - VMware vSAN Python's SDK
37 extends_documentation_fragment:
38 - community.vmware.vmware.documentation
39 author:
40     - Erwan Quelin (@equelin)
41 '''
42 
43 EXAMPLES = r'''
44 - name: Gather health info from a vSAN's cluster
45   community.vmware.vmware_vsan_health_info:
46     hostname: "{{ vcenter_hostname }}"
47     username: "{{ vcenter_username }}"
48     password: "{{ vcenter_password }}"
49     cluster_name: 'vSAN01'
50     fetch_from_cache: false
51 
52 - name: Gather health info from a vSAN's cluster with datacenter
53   community.vmware.vmware_vsan_health_info:
54     hostname: "{{ vcenter_hostname }}"
55     username: "{{ vcenter_username }}"
56     password: "{{ vcenter_password }}"
57     cluster_name: 'vSAN01'
58     datacenter: 'Datacenter_01'
59     fetch_from_cache: true
60 '''
61 
62 RETURN = r'''
63 vsan_health_info:
64     description: vSAN cluster health info
65     returned: on success
66     type: dict
67     sample: {
68         "_vimtype": "vim.cluster.VsanClusterHealthSummary",
69         "burnInTest": null,
70         "clusterStatus": {
71             "_vimtype": "vim.cluster.VsanClusterHealthSystemStatusResult",
72             "goalState": "installed",
73             "status": "green",
74             "trackedHostsStatus": [
75                 {
76                     "_vimtype": "vim.host.VsanHostHealthSystemStatusResult",
77                     "hostname": "esxi01.example.com",
78                     "issues": [],
79                     "status": "green"
80                 },
81                 {
82                     "_vimtype": "vim.host.VsanHostHealthSystemStatusResult",
83                     "hostname": "esxi04.example.com",
84                     "issues": [],
85                     "status": "green"
86                 },
87                 {
88                     "_vimtype": "vim.host.VsanHostHealthSystemStatusResult",
89                     "hostname": "esxi02.example.com",
90                     "issues": [],
91                     "status": "green"
92                 },
93                 {
94                     "_vimtype": "vim.host.VsanHostHealthSystemStatusResult",
95                     "hostname": "esxi03.example.com",
96                     "issues": [],
97                     "status": "green"
98                 }
99             ],
100             "untrackedHosts": []
101         }
102     }
103 '''
104 
105 import json
106 import traceback
107 
108 try:
109     from pyVmomi import vmodl, VmomiSupport
110     HAS_PYVMOMI = True
111     HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')
112 except ImportError:
113     PYVMOMI_IMP_ERR = traceback.format_exc()
114     HAS_PYVMOMI = False
115     HAS_PYVMOMIJSON = False
116 
117 VSANPYTHONSDK_IMP_ERR = None
118 try:
119     import vsanapiutils
120     HAS_VSANPYTHONSDK = True
121 except ImportError:
122     VSANPYTHONSDK_IMP_ERR = traceback.format_exc()
123     HAS_VSANPYTHONSDK = False
124 
125 from ansible.module_utils.basic import AnsibleModule, missing_required_lib
126 from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi
127 
128 
129 class VSANInfoManager(PyVmomi):
130     def __init__(self, module):
131         super(VSANInfoManager, self).__init__(module)
132         self.datacenter = None
133         self.cluster = None
134 
135     def gather_info(self):
136         datacenter_name = self.module.params.get('datacenter')
137         if datacenter_name:
138             self.datacenter = self.find_datacenter_by_name(datacenter_name)
139             if self.datacenter is None:
140                 self.module.fail_json(msg="Datacenter %s does not exist." % datacenter_name)
141 
142         cluster_name = self.module.params.get('cluster_name')
143         self.cluster = self.find_cluster_by_name(cluster_name=cluster_name, datacenter_name=self.datacenter)
144         if self.cluster is None:
145             self.module.fail_json(msg="Cluster %s does not exist." % cluster_name)
146 
147         fetch_from_cache = self.module.params.get('fetch_from_cache')
148 
149         client_stub = self.si._GetStub()
150         ssl_context = client_stub.schemeArgs.get('context')
151 
152         api_version = vsanapiutils.GetLatestVmodlVersion(self.module.params['hostname'])
153         vc_mos = vsanapiutils.GetVsanVcMos(client_stub, context=ssl_context, version=api_version)
154 
155         vsan_cluster_health_system = vc_mos['vsan-cluster-health-system']
156 
157         cluster_health = {}
158         try:
159             cluster_health = vsan_cluster_health_system.VsanQueryVcClusterHealthSummary(
160                 cluster=self.cluster,
161                 fetchFromCache=fetch_from_cache,
162             )
163         except vmodl.fault.NotFound as not_found:
164             self.module.fail_json(msg=not_found.msg)
165         except vmodl.fault.RuntimeFault as runtime_fault:
166             self.module.fail_json(msg=runtime_fault.msg)
167 
168         health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)
169 
170         self.module.exit_json(changed=False, vsan_health_info=health)
171 
172 
173 def main():
174     argument_spec = vmware_argument_spec()
175     argument_spec.update(
176         datacenter=dict(required=False, type='str', aliases=['datacenter_name']),
177         cluster_name=dict(required=True, type='str'),
178         fetch_from_cache=dict(required=False, type='bool', default=False)
179     )
180 
181     module = AnsibleModule(
182         argument_spec=argument_spec,
183         supports_check_mode=True
184     )
185 
186     if not HAS_VSANPYTHONSDK:
187         module.fail_json(msg=missing_required_lib('vSAN Management SDK for Python'), exception=VSANPYTHONSDK_IMP_ERR)
188 
189     if not HAS_PYVMOMIJSON:
190         module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')
191 
192     vsan_info_manager = VSANInfoManager(module)
193     vsan_info_manager.gather_info()
194 
195 
196 if __name__ == '__main__':
197     main()
198
```
--- 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_vsan_health_info.py b/plugins/modules/vmware_vsan_health_info.py
--- a/plugins/modules/vmware_vsan_health_info.py
+++ b/plugins/modules/vmware_vsan_health_info.py
@@ -167,7 +167,7 @@
 
         health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)
 
-        self.module.exit_json(changed=False, vsan_health_info=health)
+        self.module.exit_json(changed=False, vsan_health_info=json.loads(health))
 
 
 def main():

{"golden_diff": "diff --git a/plugins/modules/vmware_vsan_health_info.py b/plugins/modules/vmware_vsan_health_info.py\n--- a/plugins/modules/vmware_vsan_health_info.py\n+++ b/plugins/modules/vmware_vsan_health_info.py\n@@ -167,7 +167,7 @@\n \n         health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)\n \n-        self.module.exit_json(changed=False, vsan_health_info=health)\n+        self.module.exit_json(changed=False, vsan_health_info=json.loads(health))\n \n \n def main():\n", "issue": "Invalid return type for vmware_vsan_health_info\n<!--- Verify first that your improvement 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\n<!--- Explain the problem briefly below, add suggestions to wording or structure -->\r\n\r\nThe documentation for vmware_vsan_health_info states that the [return type is dict](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L66) but the response is wrapped into a `json.dumps` [converting it to string](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L168). I am uncertain whether the return type documentation or the returned object should be adapted, but the current inconsistency should be fixed.\r\n\r\n<!--- HINT: Did you know the documentation has an \"Edit on GitHub\" link on every page ? -->\r\n\r\n##### ISSUE TYPE\r\n- Documentation Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Write the short name of the rst file, module, plugin, task or feature below, use your best guess if unsure -->\r\nvmware_vsan_health_info\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\nansible [core 2.14.2]\r\n  config file = None\r\n  configured module search path = ['/var/home/philipp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /var/home/philipp/.local/pipx/venvs/ansible-core/lib64/python3.11/site-packages/ansible\r\n  ansible collection location = /var/home/philipp/.ansible/collections:/usr/share/ansible/collections\r\n  executable location = /var/home/philipp/.local/bin/ansible\r\n  python version = 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/var/home/philipp/.local/pipx/venvs/ansible-core/bin/python)\r\n  jinja version = 3.1.2\r\n  libyaml = True\r\n```\r\n\n", "before_files": [{"content": "#!/usr/bin/python\n\n# Copyright: (c) 2019, OVH SAS\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_vsan_health_info\nshort_description: Gather information about a VMware vSAN cluster's health\ndescription:\n    - \"Gather information about a VMware vSAN cluster's health.\"\noptions:\n    datacenter:\n        description:\n            - Name of the Datacenter.\n        required: false\n        type: str\n        aliases: [ 'datacenter_name' ]\n    cluster_name:\n        description:\n            - Name of the vSAN cluster.\n        required: true\n        type: str\n    fetch_from_cache:\n        description:\n            - C(true) to return the result from cache directly instead of running the full health check.\n        required: false\n        default: false\n        type: bool\nrequirements:\n    - VMware vSAN Python's SDK\nextends_documentation_fragment:\n- community.vmware.vmware.documentation\nauthor:\n    - Erwan Quelin (@equelin)\n'''\n\nEXAMPLES = r'''\n- name: Gather health info from a vSAN's cluster\n  community.vmware.vmware_vsan_health_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    cluster_name: 'vSAN01'\n    fetch_from_cache: false\n\n- name: Gather health info from a vSAN's cluster with datacenter\n  community.vmware.vmware_vsan_health_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    cluster_name: 'vSAN01'\n    datacenter: 'Datacenter_01'\n    fetch_from_cache: true\n'''\n\nRETURN = r'''\nvsan_health_info:\n    description: vSAN cluster health info\n    returned: on success\n    type: dict\n    sample: {\n        \"_vimtype\": \"vim.cluster.VsanClusterHealthSummary\",\n        \"burnInTest\": null,\n        \"clusterStatus\": {\n            \"_vimtype\": \"vim.cluster.VsanClusterHealthSystemStatusResult\",\n            \"goalState\": \"installed\",\n            \"status\": \"green\",\n            \"trackedHostsStatus\": [\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi01.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi04.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi02.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi03.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                }\n            ],\n            \"untrackedHosts\": []\n        }\n    }\n'''\n\nimport json\nimport traceback\n\ntry:\n    from pyVmomi import vmodl, VmomiSupport\n    HAS_PYVMOMI = True\n    HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')\nexcept ImportError:\n    PYVMOMI_IMP_ERR = traceback.format_exc()\n    HAS_PYVMOMI = False\n    HAS_PYVMOMIJSON = False\n\nVSANPYTHONSDK_IMP_ERR = None\ntry:\n    import vsanapiutils\n    HAS_VSANPYTHONSDK = True\nexcept ImportError:\n    VSANPYTHONSDK_IMP_ERR = traceback.format_exc()\n    HAS_VSANPYTHONSDK = False\n\nfrom ansible.module_utils.basic import AnsibleModule, missing_required_lib\nfrom ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi\n\n\nclass VSANInfoManager(PyVmomi):\n    def __init__(self, module):\n        super(VSANInfoManager, self).__init__(module)\n        self.datacenter = None\n        self.cluster = None\n\n    def gather_info(self):\n        datacenter_name = self.module.params.get('datacenter')\n        if datacenter_name:\n            self.datacenter = self.find_datacenter_by_name(datacenter_name)\n            if self.datacenter is None:\n                self.module.fail_json(msg=\"Datacenter %s does not exist.\" % datacenter_name)\n\n        cluster_name = self.module.params.get('cluster_name')\n        self.cluster = self.find_cluster_by_name(cluster_name=cluster_name, datacenter_name=self.datacenter)\n        if self.cluster is None:\n            self.module.fail_json(msg=\"Cluster %s does not exist.\" % cluster_name)\n\n        fetch_from_cache = self.module.params.get('fetch_from_cache')\n\n        client_stub = self.si._GetStub()\n        ssl_context = client_stub.schemeArgs.get('context')\n\n        api_version = vsanapiutils.GetLatestVmodlVersion(self.module.params['hostname'])\n        vc_mos = vsanapiutils.GetVsanVcMos(client_stub, context=ssl_context, version=api_version)\n\n        vsan_cluster_health_system = vc_mos['vsan-cluster-health-system']\n\n        cluster_health = {}\n        try:\n            cluster_health = vsan_cluster_health_system.VsanQueryVcClusterHealthSummary(\n                cluster=self.cluster,\n                fetchFromCache=fetch_from_cache,\n            )\n        except vmodl.fault.NotFound as not_found:\n            self.module.fail_json(msg=not_found.msg)\n        except vmodl.fault.RuntimeFault as runtime_fault:\n            self.module.fail_json(msg=runtime_fault.msg)\n\n        health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)\n\n        self.module.exit_json(changed=False, vsan_health_info=health)\n\n\ndef main():\n    argument_spec = vmware_argument_spec()\n    argument_spec.update(\n        datacenter=dict(required=False, type='str', aliases=['datacenter_name']),\n        cluster_name=dict(required=True, type='str'),\n        fetch_from_cache=dict(required=False, type='bool', default=False)\n    )\n\n    module = AnsibleModule(\n        argument_spec=argument_spec,\n        supports_check_mode=True\n    )\n\n    if not HAS_VSANPYTHONSDK:\n        module.fail_json(msg=missing_required_lib('vSAN Management SDK for Python'), exception=VSANPYTHONSDK_IMP_ERR)\n\n    if not HAS_PYVMOMIJSON:\n        module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')\n\n    vsan_info_manager = VSANInfoManager(module)\n    vsan_info_manager.gather_info()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/vmware_vsan_health_info.py"}], "after_files": [{"content": "#!/usr/bin/python\n\n# Copyright: (c) 2019, OVH SAS\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_vsan_health_info\nshort_description: Gather information about a VMware vSAN cluster's health\ndescription:\n    - \"Gather information about a VMware vSAN cluster's health.\"\noptions:\n    datacenter:\n        description:\n            - Name of the Datacenter.\n        required: false\n        type: str\n        aliases: [ 'datacenter_name' ]\n    cluster_name:\n        description:\n            - Name of the vSAN cluster.\n        required: true\n        type: str\n    fetch_from_cache:\n        description:\n            - C(true) to return the result from cache directly instead of running the full health check.\n        required: false\n        default: false\n        type: bool\nrequirements:\n    - VMware vSAN Python's SDK\nextends_documentation_fragment:\n- community.vmware.vmware.documentation\nauthor:\n    - Erwan Quelin (@equelin)\n'''\n\nEXAMPLES = r'''\n- name: Gather health info from a vSAN's cluster\n  community.vmware.vmware_vsan_health_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    cluster_name: 'vSAN01'\n    fetch_from_cache: false\n\n- name: Gather health info from a vSAN's cluster with datacenter\n  community.vmware.vmware_vsan_health_info:\n    hostname: \"{{ vcenter_hostname }}\"\n    username: \"{{ vcenter_username }}\"\n    password: \"{{ vcenter_password }}\"\n    cluster_name: 'vSAN01'\n    datacenter: 'Datacenter_01'\n    fetch_from_cache: true\n'''\n\nRETURN = r'''\nvsan_health_info:\n    description: vSAN cluster health info\n    returned: on success\n    type: dict\n    sample: {\n        \"_vimtype\": \"vim.cluster.VsanClusterHealthSummary\",\n        \"burnInTest\": null,\n        \"clusterStatus\": {\n            \"_vimtype\": \"vim.cluster.VsanClusterHealthSystemStatusResult\",\n            \"goalState\": \"installed\",\n            \"status\": \"green\",\n            \"trackedHostsStatus\": [\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi01.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi04.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi02.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                },\n                {\n                    \"_vimtype\": \"vim.host.VsanHostHealthSystemStatusResult\",\n                    \"hostname\": \"esxi03.example.com\",\n                    \"issues\": [],\n                    \"status\": \"green\"\n                }\n            ],\n            \"untrackedHosts\": []\n        }\n    }\n'''\n\nimport json\nimport traceback\n\ntry:\n    from pyVmomi import vmodl, VmomiSupport\n    HAS_PYVMOMI = True\n    HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')\nexcept ImportError:\n    PYVMOMI_IMP_ERR = traceback.format_exc()\n    HAS_PYVMOMI = False\n    HAS_PYVMOMIJSON = False\n\nVSANPYTHONSDK_IMP_ERR = None\ntry:\n    import vsanapiutils\n    HAS_VSANPYTHONSDK = True\nexcept ImportError:\n    VSANPYTHONSDK_IMP_ERR = traceback.format_exc()\n    HAS_VSANPYTHONSDK = False\n\nfrom ansible.module_utils.basic import AnsibleModule, missing_required_lib\nfrom ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi\n\n\nclass VSANInfoManager(PyVmomi):\n    def __init__(self, module):\n        super(VSANInfoManager, self).__init__(module)\n        self.datacenter = None\n        self.cluster = None\n\n    def gather_info(self):\n        datacenter_name = self.module.params.get('datacenter')\n        if datacenter_name:\n            self.datacenter = self.find_datacenter_by_name(datacenter_name)\n            if self.datacenter is None:\n                self.module.fail_json(msg=\"Datacenter %s does not exist.\" % datacenter_name)\n\n        cluster_name = self.module.params.get('cluster_name')\n        self.cluster = self.find_cluster_by_name(cluster_name=cluster_name, datacenter_name=self.datacenter)\n        if self.cluster is None:\n            self.module.fail_json(msg=\"Cluster %s does not exist.\" % cluster_name)\n\n        fetch_from_cache = self.module.params.get('fetch_from_cache')\n\n        client_stub = self.si._GetStub()\n        ssl_context = client_stub.schemeArgs.get('context')\n\n        api_version = vsanapiutils.GetLatestVmodlVersion(self.module.params['hostname'])\n        vc_mos = vsanapiutils.GetVsanVcMos(client_stub, context=ssl_context, version=api_version)\n\n        vsan_cluster_health_system = vc_mos['vsan-cluster-health-system']\n\n        cluster_health = {}\n        try:\n            cluster_health = vsan_cluster_health_system.VsanQueryVcClusterHealthSummary(\n                cluster=self.cluster,\n                fetchFromCache=fetch_from_cache,\n            )\n        except vmodl.fault.NotFound as not_found:\n            self.module.fail_json(msg=not_found.msg)\n        except vmodl.fault.RuntimeFault as runtime_fault:\n            self.module.fail_json(msg=runtime_fault.msg)\n\n        health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)\n\n        self.module.exit_json(changed=False, vsan_health_info=json.loads(health))\n\n\ndef main():\n    argument_spec = vmware_argument_spec()\n    argument_spec.update(\n        datacenter=dict(required=False, type='str', aliases=['datacenter_name']),\n        cluster_name=dict(required=True, type='str'),\n        fetch_from_cache=dict(required=False, type='bool', default=False)\n    )\n\n    module = AnsibleModule(\n        argument_spec=argument_spec,\n        supports_check_mode=True\n    )\n\n    if not HAS_VSANPYTHONSDK:\n        module.fail_json(msg=missing_required_lib('vSAN Management SDK for Python'), exception=VSANPYTHONSDK_IMP_ERR)\n\n    if not HAS_PYVMOMIJSON:\n        module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')\n\n    vsan_info_manager = VSANInfoManager(module)\n    vsan_info_manager.gather_info()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/vmware_vsan_health_info.py"}]}