# Troubleshooting Dynamic Inventory in vmware.vmware.vms

**URL:** <https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453>\
**Category:** Get Help\
**Tags:** vmware, inventory, galaxy-ng\
**Created:** [September 10, 2025, 8:07am UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453 "2025-09-10T08:07:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bzaks1424](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bzaks1424/32/9404_2.png) [@bzaks1424](https://forum.ansible.com/u/bzaks1424)\
**Post date:** [September 10, 2025, 8:07am UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/1 "2025-09-10T08:07:08Z")

</div>

**Troubleshooting Dynamic Inventory in vmware.vmware.vms**.

My goal is _simply_ to configure ansible against my vcenter for dynamic inventory to start. When I run the script - even with a bad vcenter hostname - it runs instantly and fails - meaning I’m not even getting the point of connecting to vcenter and failing that way.

I started by creating my project in poetry:

```auto
poetry init --no-interaction --author "$(git config --get user.name)" --name "myproject"
# edit pyproject.toml to set package-mode = false
poetry config --local virtualenvs.in-project true
poetry install

```

I then activated my source and started installing all the things:

```auto
source .venv/bin/activate
poetry add ansible ansible-core
# to be safe:
ansible-galaxy collection install vmware.vmware
poetry add $(cat ~/.ansible/collections/ansible_collections/vmware/vmware/requirements.txt)

```

I created my playbook yaml:

```auto
mkdir -p ansible/playbooks/dynamic_inventory/
vi ansible/playbooks/dynamic_inventory/vmware.yml

```

Here’s my file with password obviously obfuscated

```auto
---
plugin: vmware.vmware.vms
hostname: vcenter.lab.myhome.com
username: administrator@vsphere.local
password: xxxxxxxx
validate_certs: False

```

Here’s the command I ran to try and figure out what’s going on and its output:

```auto
 ANSIBLE_DEBUG=1 ansible-inventory -i ansible/playbooks/dynamic_inventory/vmware.yml --list -vvvvv
 37908 1757478878.41400: starting run
 37908 1757478878.41419: Created the '/home/bzaks1424/.ansible' directory
ansible-inventory [core 2.19.2]
  config file = /home/bzaks1424/workspace/myproject/ansible.cfg
  configured module search path = ['/home/bzaks1424/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/bzaks1424/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/bzaks1424/workspace/myproject/.venv/bin/ansible-inventory
  python version = 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] (/home/bzaks1424/workspace/myproject/.venv/bin/python)
  jinja version = 3.1.6
  pyyaml version = 6.0.2 (with libyaml v0.2.5)
Using /home/bzaks1424/workspace/myproject/ansible.cfg as config file
 37908 1757478878.41605: Added group all to inventory
 37908 1757478878.41608: Added group ungrouped to inventory
 37908 1757478878.41612: Group all now contains ungrouped
 37908 1757478878.41614: Examining possible inventory source: /home/bzaks1424/workspace/myproject/ansible/playbooks/dynamic_inventory/vmware.yml
setting up inventory plugins
Loading collection vmware.vmware from /home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware
Loading collection ansible.builtin from 
/home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/vmware/vapi/l10n/bundle.py:59: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import resource_string
 37908 1757478878.65551: Loading ModuleDocFragment 'ansible_collections.vmware.vmware.plugins.doc_fragments.base_options' from /home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/doc_fragments/base_options.py
 37908 1757478878.65651: Loading ModuleDocFragment 'ansible_collections.vmware.vmware.plugins.doc_fragments.additional_rest_options' from /home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/doc_fragments/additional_rest_options.py
 37908 1757478878.65695: Loading ModuleDocFragment 'ansible_collections.vmware.vmware.plugins.doc_fragments.plugin_base_options' from /home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/doc_fragments/plugin_base_options.py
 37908 1757478878.65871: Loading ModuleDocFragment 'ansible_collections.ansible.builtin.plugins.doc_fragments.inventory_cache' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/doc_fragments/inventory_cache.py
 37908 1757478878.66009: Loading ModuleDocFragment 'ansible_collections.ansible.builtin.plugins.doc_fragments.constructed' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/doc_fragments/constructed.py
 37908 1757478878.66134: Loaded config def from plugin (inventory/ansible_collections.vmware.vmware.plugins.inventory.vms)
 37908 1757478878.66136: Loading InventoryModule 'ansible_collections.vmware.vmware.plugins.inventory.vms' from /home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py
 37908 1757478878.66141: Attempting to use plugin ansible_collections.vmware.vmware.plugins.inventory.vms (/home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py)
ansible_collections.vmware.vmware.plugins.inventory.vms declined parsing /home/bzaks1424/workspace/myproject/ansible/playbooks/dynamic_inventory/vmware.yml as it did not pass its verify_file() method
[WARNING]: Unable to parse /home/bzaks1424/workspace/myproject/ansible/playbooks/dynamic_inventory/vmware.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
 37908 1757478878.66233: '/home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/vars/ __init__' skipped due to reserved name
 37908 1757478878.66349: trying /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/doc_fragments
 37908 1757478878.66378: Loading ModuleDocFragment 'vars_plugin_staging' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/doc_fragments/vars_plugin_staging.py
 37908 1757478878.66413: Loaded config def from plugin (vars/host_group_vars)
 37908 1757478878.66415: Loading VarsModule 'host_group_vars' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/vars/host_group_vars.py (found_in_cache=False, class_only=True)
 37908 1757478878.66421: trying /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/vars
 37908 1757478878.66426: Loading VarsModule 'host_group_vars' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/vars/host_group_vars.py (found_in_cache=True, class_only=False)
 37908 1757478878.66450: trying /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/cache
 37908 1757478878.66497: Loading CacheModule 'memory' from /home/bzaks1424/workspace/myproject/.venv/lib/python3.12/site-packages/ansible/plugins/cache/memory.py
{
    "_meta": {
        "hostvars": {},
        "profile": "inventory_legacy"
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

```

I genuinely cannot see smoking guns in this debug output to give me a place to start looking to fix my problem. I spent several hours with a couple of bad LLMs who led me in circles - so I’m going to the real experts for help.

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [September 10, 2025, 12:27pm UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/2 "2025-09-10T12:27:41Z")

</div>

I was able to reproduce this, with one tweak I got _more_ information. Its not a solution, but it might help.

Based on [this doc](https://docs.ansible.com/ansible/5/collections/community/vmware/docsite/vmware_scenarios/vmware_inventory.html#vmware-dynamic-inventory-plugin) on the dynamic vmware inventory plugin, I added

```auto
[inventory]
enable_plugins = vmware.vmware_vm_inventory

```

to my local ansible.cfg

(This file doesn’t automatically exist, so I generated a “default” one with `ansible-config init --disabled > ansible.cfg ` and then added that one change to it).

After that, I get the following _additional_ information on the failure.

```auto
[WARNING]: Failed to load inventory plugin, skipping vmware.vmware_vm_inventory                                                                            
[WARNING]: Failed to parse inventory with 'auto' plugin: inventory source '/data/testing/vcenter_dynamic_test/ansible/playbooks/dynamic_inventory/vmware.yml' could not be verified by inventory plugin 'vmware.vmware.vms' 

```

So far, I haven’t determined what’s causing this, but hopefully this extra nugget can help someone get you closer to the answer.

---

<div class="post-metadata">

**Author:** ![bzaks1424](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bzaks1424/32/9404_2.png) [@bzaks1424](https://forum.ansible.com/u/bzaks1424)\
**Post date:** [September 10, 2025, 12:58pm UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/3 "2025-09-10T12:58:51Z")

</div>

Hey that was actually really helpful! It at least gave me new errors to fixate on

The doc you’re using is labeled as “unmaintained” - the latest and official docs are [here](https://docs.ansible.com/ansible/latest/collections/vmware/vmware/vms_inventory.html)

But I also hadn’t generated that default Ansible config - so I started with your bit and went from there. Playing “detective” - I decided to make sure that the same exact plugin was enabled in my cfg that’s at the top of my yaml `vmware.vmware.vms`  
ansible.cfg:

```auto
[inventory]
enable_plugins = vmware.vmware.vms

```

And the the resulting text is exactly the same as my original output 🤦‍♂️

```auto
  8489 1757508511.26089: Attempting to use plugin ansible_collections.vmware.vmware.plugins.inventory.vms (/home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py)
ansible_collections.vmware.vmware.plugins.inventory.vms declined parsing /home/bzaks1424/workspace/myproject/ansible/playbooks/dynamic_inventory/vmware.yml as it did not pass its verify_file() method
[WARNING]: Unable to parse /home/bzaks1424/workspace/myproject/ansible/playbooks/dynamic_inventory/vmware.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

```

This led me to ask "Is there no way to debug the verify\_file method? And then I saw it:

```auto
8489 1757508511.26089: Attempting to use plugin ansible_collections.vmware.vmware.plugins.inventory.vms (/home/bzaks1424/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py)

```

Naturally - I realized I could just look at the method.

```auto
vi ~/.ansible/collections/ansible_collections/vmware/vmware/plugins/inventory/vms.py

def verify_file(self, path):
    """
    Checks the plugin configuration file format and name, and returns True
    if everything is valid.
    Args:
        path: Path to the configuration YAML file
    Returns: 
        True if everything is correct, else False
    """
    if super(InventoryModule, self).verify_file(path):
        return path.endswith(
            (
                "vms.yml",
                "vms.yaml",
                "vmware_vms.yaml",
                "vmware_vms.yml"
            )
        )
    return False

```

I renamed my yml file to “vmware\_vms.yml” and it magically works. I don’t know if I should cheer or cry.

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [September 10, 2025, 1:20pm UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/4 "2025-09-10T13:20:50Z")

</div>

> [@bzaks1424](#):
>
> The doc you’re using is labeled as “unmaintained” - the latest and official docs are [here](https://docs.ansible.com/ansible/latest/collections/vmware/vmware/vms_inventory.html)

Good catch. I just did a quick google search and found it.

> [@bzaks1424](#):
>
> I renamed my yml file to “vmware\_vms.yml” and it magically works. I don’t know if I should cheer or cry.

both!

Also, on reading the current doc you linked, I did see something that _hints_ at this in the [examples section](https://docs.ansible.com/ansible/latest/collections/vmware/vmware/vms_inventory.html#examples)

```auto
# Below are examples of inventory configuration files that can be used with this plugin.
# To test these and see the resulting inventory, save the snippet in a file named **hosts.vmware_vms.yml** and run:
# ansible-inventory -i **hosts.vmware_vms.yml** --list

```

( **emphasis** is mine)

---

<div class="post-metadata">

**Author:** ![bzaks1424](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bzaks1424/32/9404_2.png) [@bzaks1424](https://forum.ansible.com/u/bzaks1424)\
**Post date:** [September 10, 2025, 2:01pm UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/5 "2025-09-10T14:01:41Z")

</div>

Clearly I missed a line in the requirements:

```auto
Uses any file which ends with vms.yml, vms.yaml, vmware_vms.yml, or vmware_vms.yaml as a YAML configuration file.

```

So I can only blame that jerk in the mirror.

Thanks again for all of your help @Lyle_McKarns !!!

---

<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:** [October 10, 2025, 2:01pm UTC](https://forum.ansible.com/t/troubleshooting-dynamic-inventory-in-vmware-vmware-vms/44453/6 "2025-10-10T14:01:58Z")

</div>

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