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:
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:
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:
mkdir -p ansible/playbooks/dynamic_inventory/
vi ansible/playbooks/dynamic_inventory/vmware.yml
Here’s my file with password obviously obfuscated
---
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:
 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.