VMWare Dynamic Inventory Script

2,374 views
Skip to first unread message

TextEditor

unread,
Jan 8, 2014, 3:36:47 AM1/8/14
to ansible...@googlegroups.com
I've made a simple python script which uses VMWare vCenter to create a Dynamic Inventory. It is very simple, does not support grouping by datacenter or resource groups (yet, pull requests accepted). 

https://raymii.org/s/software/Ansible__Dynamic_Inventory_From_VMware_vCenter.html

I'd like some feedback and testing on it. It works for me at our vCenter 5.5 cluster, which, has only *NIX vm's.

Brian Coca

unread,
Jan 8, 2014, 8:44:10 AM1/8/14
to ansible...@googlegroups.com

I'm working on the same.



--
Brian Coca
Stultorum infinitus est numerus
0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001
Pedo mellon a minno

Michael DeHaan

unread,
Jan 8, 2014, 8:48:56 AM1/8/14
to ansible...@googlegroups.com
Excellent,

Both vcenter and vsphere together would be ideal.

We're seeing increased interest in folks of having VMware inventory lately, I think to date a lot of VMware was in the "I'm going to ask for an IP from IT" mode, so very glad to see this change and more folks (non-Ansible-specific-comment) treat it more like a cloud service.

I'd also like to see some VMware provisioning modules in core, though I'd also want to make sure we had some for non-vcloud too.

Any other services/configuration modules for it are also fair game!






--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

Brian Coca

unread,
Jan 8, 2014, 9:05:45 AM1/8/14
to ansible...@googlegroups.com
I named it vsphere but it works with standalone vcenter directly, both apis are basically the same with vsphere having 'more capabilities'.

Once this is stable my next step was going to be to try and get the provisioning plugins from ansible-provisioning project into core.

TextEditor

unread,
Jan 8, 2014, 3:12:44 PM1/8/14
to ansible...@googlegroups.com


Op woensdag 8 januari 2014 14:48:56 UTC+1 schreef Michael DeHaan:
Excellent,

Both vcenter and vsphere together would be ideal.
 
It also works on standalone ESXi hosts as far as I can see. (Just tried it).  

We're seeing increased interest in folks of having VMware inventory lately, I think to date a lot of VMware was in the "I'm going to ask for an IP from IT" mode, so very glad to see this change and more folks (non-Ansible-specific-comment) treat it more like a cloud service.

VMWare seems to be more enterprisy. Who asks for a VM IP these days... 

I'd also like to see some VMware provisioning modules in core, though I'd also want to make sure we had some for non-vcloud too.
 
The pysphere module currently does not have the capability to create a VM, however there is some example code: https://groups.google.com/forum/#!msg/pysphere/VF9pN9qU-94/YxVHeae8anoJ

It is possible, there is a rubygem that does support it. We use that to create a VM, then provision it further with Ansible and Cobbler.

Romeo Theriault

unread,
Jan 8, 2014, 3:29:46 PM1/8/14
to ansible...@googlegroups.com
On Wed, Jan 8, 2014 at 4:05 AM, Brian Coca <bria...@gmail.com> wrote:

Once this is stable my next step was going to be to try and get the provisioning plugins from ansible-provisioning project into core.

Hi Brian, I wrote the vsphere_guest[1] ansible module in the ansible-provisioning repo. If you have the time to work on the module to make it more 'idempotent' that'd be great. Currently it can create the VM just fine but can't modify it after the fact. It just checks if the VM exists and skips the creation steps if it does. This is one area that could be improved. Here is an example of how I use the module to create VM's in our environment:


--
Romeo

Brian Coca

unread,
Jan 8, 2014, 4:42:18 PM1/8/14
to ansible...@googlegroups.com
@romeo, I'll check that out, since this will be used at my current job I'll probably be able to dedicate the time.

mwi...@vmware.com

unread,
Aug 6, 2014, 2:50:15 PM8/6/14
to ansible...@googlegroups.com
You may consider reviewing https://github.com/vmware/pyvmomi, which offers a full rest-api to vsphere. This will enhance or possibly replace vsphere_guest functionality

Michael DeHaan

unread,
Aug 6, 2014, 7:24:30 PM8/6/14
to ansible...@googlegroups.com
Yeah currently we have the inventory module using one python module and the provisioner users the other.

Both are functional but would be nice to standardize for sure.

I don't think it would replace "vsphere_guest" the module at all - we still want the module, but the module can be open to using other libraries if not enough functionality is surfaced.

Right now I'm not quite clear on what those things might be, but again, open to expansion, totally.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages