dynamic inventory

30 views
Skip to first unread message

Sloan Miller

unread,
Aug 1, 2019, 4:10:24 PM8/1/19
to Ansible Project
I am trying to get dynamic inventory working.  I have not found much on the internet or in the docs that give a high level overview as to how the configs and files relate.  Any tips?


Can I get some suggestions on my dynamic inventory config?  

Is there a simple way to test and determine whether these two vmware python libraries are working as required?

 

----- From the link below -------------------

Requires 'vSphere Automation SDK' and 'vCloud Suite SDK' libraries to be installed on the given controller machine.

Please refer following URLs for installation steps

https://code.vmware.com/web/sdk/65/vsphere-automation-python

https://code.vmware.com/web/sdk/60/vcloudsuite-python


https://docs.ansible.com/ansible/latest/plugins/inventory/vmware_vm_inventory.html


-------------------------------------------------------------


I am running the ansible.cfg file in my current working directory.



In ansible.cfg 


I have tried these at seperate times and together

inventory       = /etc/ansible/hosts

inventory       = vmware_vm_inventory


[inventory]

enable_plugins = vmware_vm_inventory, host_list, virtualbox, yaml, constructed


==================


This file is in my current working directory


ansible-admin-> cat test.vmware.yml


plugin: vmware_vm_inventory

    strict: False

    hostname: remote-vmware-server.com

    username: myu...@vsphere.dev.local

    password: myPassword

    validate_certs: False

    with_tags: True



=========================================


To execute and test a playbook with dynamic inventory


ansible-playbook  ../../custom-fact-setup.yml


I tried this too and not working


ansible-playbook  ../../custom-fact-setup.yml -i test.vmware.yml




------------

Error message

[WARNING]:  * Failed to parse /etc/ansible/repo/ansible-CPC/custom-facts/files/test.vmware.yml with vmware_vm_inventory plugin: Unable to find

'vSphere Automation SDK' Python library which is required. Please refer this URL for installation steps - https://code.vmware.com/web/sdk/65/vsphere-

automation-python




 


Brian Coca

unread,
Aug 7, 2019, 11:09:45 AM8/7/19
to Ansible Project
on the config side your indentation seems wrong (but that might just
be an email issue), your main problem though is that you need the
vmware sdk installed on the same python that ansible is using to
execute.



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages