# Dynamic Inventory on VMWare not working; but works when the script is run directly

**URL:** <https://forum.ansible.com/t/dynamic-inventory-on-vmware-not-working-but-works-when-the-script-is-run-directly/29843>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [March 7, 2019, 5:52pm UTC](https://forum.ansible.com/t/dynamic-inventory-on-vmware-not-working-but-works-when-the-script-is-run-directly/29843 "2019-03-07T17:52:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![computerprosupport](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@computerprosupport](https://forum.ansible.com/u/computerprosupport)\
**Post date:** [March 7, 2019, 5:52pm UTC](https://forum.ansible.com/t/dynamic-inventory-on-vmware-not-working-but-works-when-the-script-is-run-directly/29843/1 "2019-03-07T17:52:17Z")

</div>

I am trying to implement Dynamic Inventory for VMWare with the vmware\_inventory.py script  
From here :  
[https://github.com/ansible/ansible/blob/devel/contrib/inventory/vmware\_inventory.py](https://github.com/ansible/ansible/blob/devel/contrib/inventory/vmware_inventory.py)

I have searched for docs on the ansible site and also google searched and there is nothing useful.

the script vmware\_inventory.py works and produces a list of VMs when run directly

# . python2 vmware\_inventory.py

But when i try this  
ansible -i vmware\_inventory.py all -m shell -a “cat /etc/redhat-release”

nothing happens

This is from my ansible.cfg

[inventory]  
enable\_plugins = vmware\_vm\_inventory, host\_list, script, yaml, ini, auto

I created a vmware.yml file in /etc/ansible but no luck. There are no details as to what is required to get this working

[https://docs.ansible.com/ansible/latest/plugins/inventory/vmware\_vm\_inventory.html](https://docs.ansible.com/ansible/latest/plugins/inventory/vmware_vm_inventory.html)

vmware.yml

```auto
# Sample configuration file for VMware Guest dynamic inventory
    plugin: vmware_vm_inventory
    strict: False
    hostname: 10.65.223.31
    username: administrator@vsphere.local
    password: Esxi@123$%
    validate_certs: False
    with_tags: True

```
