I want to use the vSphere_guest module to stand up a bunch of VMware VMs. But I don’t see a way to configure static IP. There are a few ways of making this happen, all involving the writing of custom code.
Is there really no way of doing this within the scope of the module? If not, any plans to add this functionality?
Jeff,
You need to send the clone operation an customization spec in order to do guest customizations on a vSphere VM. This is not included in the vsphere_guest module.
In the meantime, you can look at a module I wrote to accomplish this: https://github.com/whereismyjetpack/ansible_vcenter_module. It allows you to send specific guest customization parameters to the clone operation, the module is not ansibly (one of the first complaints I got), and requires pyvmomi instead of pysphere. I’ve been using this in production for a little over a year… feel free to contact me if you have any questions, and time permitting i’ll do my best to answer them. I’ve tested this code on vSphere 5.5 and 6.0.
Many thanks Dann, I’ll take a look. Yes, looks like the Ansible guys are onto it. I’m just about at the end of my own hand-crafted solution right now. So I’ll finish this off and take a look at your module afterwards.
We do have plans to create a new guest module that also use pyvimomi, all modules should be using that library soon, also the inventory script, which is in devel right now.
Hey Dann, I’m drawing a blank on the final piece in my puzzle here, maybe you can help(?). I’ve registered the vmware_guest_facts in a var and just want to iterate through it, for each hw_eth0.ipaddresses[0] … e.g. this was my last (tortured) attempt:
name: copy new file into place
delegate_to: “{{ item.[ {{ hw_eth0.ipaddresses[0] }} ] }}”
template: src=xxxxxxx dest=/etc/xxxxxxxxxx
with_nested:
Is there anything I can do to help? I brought this up in the devel list a few years ago, and was told that ansible didn't want to swap out the pysphere requirement, and at the time couldn't get pysphere to do what I wanted. I'd love to have some meaningful contribution back to the project
Dann, yes, after a lot of back and forth we decided to standardize on pyvimomi, all new modules have been using this library, the inventory script (which I wrote) and the vsphere_guest modules are the only outliers (they each use diff libs).
We currently have in devel a rewritten inventory script, so vsphere_guest is the last item on the list, we were planning on creating a new module(s) based on pyvimomi and deprecating vsphere_guest.
I was thinking of a vmware_vm or similar and possibly break out some of the functions in vsphere_guest to make 2 or 3 simpler modules (vmware_net, vmware_volume, etc), but there are no decisions made on this yet.