# Can't get vmware.vmware.vms to run

**URL:** <https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207>\
**Category:** Get Help\
**Tags:** kubernetes, vmware, inventory, galaxy-ng\
**Created:** [August 5, 2025, 2:51pm UTC](https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207 "2025-08-05T14:51:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnsiBrokeMe](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AnsiBrokeMe](https://forum.ansible.com/u/AnsiBrokeMe)\
**Post date:** [August 5, 2025, 2:51pm UTC](https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207/1 "2025-08-05T14:51:13Z")

</div>

Hello dear Ansible community 👋.  
I am writting here my first post and I am still a beginner with ansible. So if there is anything to fix with my post let me know.

\*\* What did I try so far \*\*  
So far I have tried to setup everything as described in the documentation here:

- [Ansible Galaxy](https://galaxy.ansible.com/ui/repo/published/vmware/vmware/docs/)

So to summarize I did:

1. Create a new virtual environment with Python version 3.12.3
2. I installed ansible using `sudo apt install ansible`
3. I installed the required ansible collection using `ansible-galaxy collection install vmware.vmware`
4. After that I installed the required python packages using `pip install -r ~/.ansible/collections/ansible_collections/vmware/vmware/requirements.txt`
5. I exported the required environment Variables `VMWARE_USER`, `VMWARE_PASSWORD` and `VMWARE_HOST`
6. I prepared the dynamic inventory using the requested naming convention `hosts.vmware_vms.yaml`

```yaml
---
plugin: vmware.vmware.vms
gather_tags: true
validate_certs: false

keyed_groups:
- key: tags_by_category.env | map('dict2items') | map('first') | map(attribute='value')
  prefix: "vmware_tag_env"
  separator: "-"

```

1. Having ever everything prepared I wanted to show my dynamic inventory using `ansible-inventory -i ./inventory/hosts.vmware_vms.yaml --list -vvvv`

Unfortunately this failed. Infos to why it failed can be seen in the investigation section.

**Initial investigations**

Here you can see the verbose output of the dynamic inventory

```bash
ansible-inventory [core 2.16.3]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-inventory
  python version = 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml as it did not pass its verify_file() method
script declined parsing /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml as it did not pass its verify_file() method
Loading collection vmware.vmware from /root/.ansible/collections/ansible_collections/vmware/vmware
toml declined parsing /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml as it did not pass its verify_file() method
[WARNING]: * Failed to parse /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml with auto plugin: module 'ssl' has no attribute 'wrap_socket'
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/auto.py", line 50, in parse
    plugin = inventory_loader.get(plugin_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/loader.py", line 864, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/loader.py", line 899, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/loader.py", line 837, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/root/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py", line 174, in <module>
    from pyVmomi import vim
  File "/usr/lib/python3/dist-packages/pyVmomi/ __init__.py", line 204, in <module>
    from pyVmomi.SoapAdapter import SoapStubAdapter, StubAdapterBase, SoapCmdStubAdapter, \
  File "/usr/lib/python3/dist-packages/pyVmomi/SoapAdapter.py", line 993, in <module>
    _SocketWrapper = ssl.wrap_socket
                     ^^^^^^^^^^^^^^^
[WARNING]: * Failed to parse /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]: * Failed to parse /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a YAML file.
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/ini.py", line 138, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /home/gere/Documents/Gitlab/workloadanalysis/workloads/propositions/k8s/ansible/inventory/hosts.vmware_vms.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

```

In my opinion it seems to have some issues with the ssl… but I really don’t understand why, since I have set the `valid_certs: false`.

Did anyone of you experience the same troubles setting up this dynamic inventory?  
Or would anyone have a few tips on how to properly debug/resolve this?

Thank you very much upfront 🙏

---

<div class="post-metadata">

**Author:** ![mariolenz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mariolenz/32/108_2.png) [@mariolenz](https://forum.ansible.com/u/mariolenz)\
**Post date:** [August 5, 2025, 4:41pm UTC](https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207/2 "2025-08-05T16:41:29Z")

</div>

I’m not sure if I can help you there, but somehow there are some things that I don’t understand and I would like to mention.

For example, you say you’re creating a venv but then install ansible via `sudo apt install ansible`. This doesn’t make sense. This will install ansible system-wide, but not in your venv. So I don’t understand what you’ve created the venv for.

Did you try to [activate (source)](https://docs.python.org/3/library/venv.html#how-venvs-work) the venv and install ansible with `pip install ansible`? This should already contain the `vmware.vmware` collection.

Alternatively, you could also just install `ansible-core` with `pip install ansible-core` (while the venv is activated) and and then install the collection with `ansible-galaxy collection install vmware.vmware`.

Of course, you would still have to install the requirements. But maybe this helps.

---

<div class="post-metadata">

**Author:** ![AnsiBrokeMe](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AnsiBrokeMe](https://forum.ansible.com/u/AnsiBrokeMe)\
**Post date:** [August 5, 2025, 6:11pm UTC](https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207/3 "2025-08-05T18:11:05Z")

</div>

Hello @mariolenz . I am very happy, that those things do not make any sense to you! Because they dont!  
I just deleted my venv and recreated a new one. In this venv I properly installed ansible via the `pip install ansible` command + added the required vsphere-automation-sdk for python ([GitHub - vmware/vsphere-automation-sdk-python: Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API](https://github.com/vmware/vsphere-automation-sdk-python)).

And boom 💥 it’s finally working.

Thank you very much for pointing me in the right direction!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 4, 2025, 6:11pm UTC](https://forum.ansible.com/t/cant-get-vmware-vmware-vms-to-run/44207/4 "2025-09-04T18:11:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
