Hey guys, I've recently been looking to control vsphere via Ansible which lead me to this thread. Noticed a couple pull requests that were before the September 26th git core-module/extra-module split by the Ansible team. Just wanted to revive this thread for those that had PRs that were closed before resolution.
Cheers, On Saturday, August 23, 2014 8:31:00 AM UTC-5, Dann Bohn wrote: > > It seems a few of us have different implementations of cloning a template, > or VM. here's mine: Mine sets state to 'clone' (which probably should be > 'cloned' or something more descriptive?) and then adds a parameter: > template: to specify a template/VM in which to clone from. I had also > noticed there is another PR out there to deploy from template. > > https://github.com/whereismyjetpack/ansible/tree/clone > > If you look at the branch you'll see there is a lot of logic regarding > folders, our organization uses VM folders heavily to grant access and > divide systems, so I baked that in, too (it's not documented yet) > > I'm waiting on feedback from this PR to document the clone/new vm folders > https://github.com/ansible/ansible/pull/7792 > > P.S I'm also LogLevel9 -- i somehow got two github accounts and I'm trying > to merge them into one. > > On Friday, August 22, 2014 10:07:02 AM UTC-4, Michael DeHaan wrote: > > "I think the idea of adding hooks that expose the functionality in an > 'extra-params' like way is the way to go" > It's not. > > We really want to model things as nouns, so the vsphere_guest module > should take a parameter that can boot from a cloned image. > > > On Thu, Aug 21, 2014 at 9:12 AM, kesten broughton <[email protected]> > wrote: > > Snapshots let you store the state of a vm to roll back to later. It's > different from cloning. I searched the module for "clone" and "template" > and neither is there. > > The examples don't cover all the config options, nor do the docs. > vm_hardware: memory_mb: 2048 num_cpus: 2 osid: centos64Guest scsi: > paravirtual but when I played with vsphere_guest my conclusion was that > the only support for selecting the base for the vm was > def add_cdrom(module, s, config_target, config, devices, default_devs, > type="client", vm_cd_iso_path=None): > > In vmware, there are two very different paths for creating a vm. One, you > select the cd_rom which is like a bootable iso. The other (more common) is > to build up a template (i believe it is backed by a vmdk) and then clone > from the template. The latter is the functionality i need, and the former > is all that is supported. I could be wrong, but would need an example to > show cloning with the given api. > > Tony, I am talking about adding a volume after boot, for logs or data > drives, although creating partitions on boot would be nice too. > > Vsphere is capable of sooo much, I think the idea of adding hooks that > expose the functionality in an 'extra-params' like way is the way to go, > otherwise you end up with a dozen vsphere-x modules. If vsphere_guest has > that capability and it just needs exposing, great. If it is fundamentally > not extend then perhaps other options should be explored. > > I think apt and synchronize already offer this type of "deeper through > extra-args" functionality. Perhaps the best option would be a master module > capable of pretty much everything (with good documentation) and then a few > facades modules for the most common usages. The code should be factored out > into a handful of modules plus some helper classes that are used by all > modules, like authentication and connection. > > The trouble with the current vsphere_guest is it offers insufficient > capabilities to satisfy any real-world usage pattern, and there doesn't > seem to be much activity in extending it to do so. Tony's module with the > built in power via spec can do orders of magnitude more but would need lots > of examples for the various use cases. > > I will try to play with the spec today to see if it meets my needs. > > > On Wed, Aug 20, 2014 at 9:34 PM, Michael DeHaan <[email protected]> > wrote: > > It would be much better to add that capability to the existing one than > bifurcate the modules. > > See this pull request, though it hasn't had comments answered on it - > https://github.com/ansible/ansible/pull/7690 > > Though I would tend to think maybe snapshot is a different module, and > cloning is a parameter of the existing one. > > Send me a pull request for an update and we can definitely prioritize it, > I don't want to see these start to fork - there's no good reason for that. > > > On Wed, Aug 20, 2014 at 10:03 PM, kesten broughton <[email protected]> > wrote: > > I started with vsphere_guest but had to give up for lack of the ability to > clone from a vm. There was talk about it, but i don't think it ever made > it to trunk. > > It's unfortunate perhaps that vsphere_guest relies on pysphere whereas the > current effort depends on pyvmomi which is vmware's officially supported > python API. > > I need to clone from vm and supply disks. vsphere_guest has the disk > support and ansible-vsphere has clone from template. > > pyshere has a headstart in terms of exposed (documented) functionality and > community, but will likely be eclipsed by pyvmomi if it can garner a > community. Maybe for now a hybrid approach is necessary with pip-pointed > modules dependent on both. It's no big deal for for a vsphere lover to > install both dependencies, although likely one will win in the end. > > > > On Wed, Aug 20, 2014 at 8:40 PM, Michael DeHaan <[email protected]> > wrote: > > Can I ask what's intended to be different from the module we already have > in core? > > http://docs.ansible.com/vsphere_guest_module.html > > > > > On Wed, Aug 20, 2014 at 9:27 PM, kesten broughton <[email protected]> > wrote: > > Nice work! That's half my battle, > the rest is attaching volumes. > > Does your module support that sort of thing? > How would you extend to do that? > > kesten > > > On Wed, Aug 20, 2014 at 7:18 PM, Tony Kinsley <[email protected]> wrote: > > I actually recently got approval to release a module I wrote to manage > vsphere. You can find it at https://github.com/ViaSat/ansible-vsphere > > We currently use this to manage our datacenter of test and development > vms. It uses pyvmomi which is VMWares python library for interacting with > the vsphere api. > It currently has support for: > > - Create, Clone ( from templates as well ), Delete VMs > - Create, Remove, and Revert to VM snapshots > - Create, Remove Inventory Folders > - Interact with the Guest Operations Manager. > > So in order to get support for all those different things, I came up with > a way to convert a "spec" object into pyvmomi objects. This allows me to > call roughly any function on a Managed Object Reference. I hope it is not > too confusing and the documentation is clear. I gave examples but there is > likely more that the module is capable of than the examples I gave. My hope > is that this module could be one day included in the core Ansible project. > > Let me know what you think. > Tony > > On Tuesday, August 5, 2014 1:53:03 PM UTC-7, Jamal B wrote: > > Hi, is there a chance that cloning will be added to the vsphere_guest > module in an upcoming release? > > On Thursday, July 10, 2014 9:08:23 AM UTC-4, kesten broughton wrote: > > I would agree, cloning functionality belongs in vsphere_guest module if > possible. > > On Wednesday, July 9, 2014 4:30:32 PM UTC-5, Michael DeHaan wrote: > > It seems in this case we should try to work the features into the existing > module, since they are both about creating guests? > > > > > On Wed, Jul 9, 2014 at 3:54 PM, kesten broughton <[email protected]> > wrote: > > I was referring to the vsphere_clone mentioned, not vsphere_guest which is > in trunk https://github.com/ansible/ansible/tree/devel/library/cloud > > As far as i can tell, vsphere_guest currently only supports creating a vm > from .iso > > What i really need is creating clones from a template. > > k > > > > On Wed, Jul 9, 2014 at 2:47 PM, Michael DeHaan <[email protected]> wrote: > > This is actually already in core. > > > > > On Wed, Jul 9, 2014 at 8:11 AM, kesten broughton <[email protected]> > wrote: > > If you've got a public git branch, i can help with testing and > documentation. > I've worked with pysphere a bit. > > kesten > > On Tuesday, July 8, 2014 6:23:06 PM UTC-5, Corey Gaffney wrote: > > In looking at my original proposal, I think combining two unique > implementations of Async functionality is going to be a bad idea, if not > for being difficult to troubleshoot and impossible to test, for being a bad > design. > > Instead, I would like to suggest not using PySphere Async support and have > Ansible handle Async via it's own mechanism 100%. While it will prevent > having the ability to use Async while using with_items and with_nested, it > would be consistent with other modules and if this were to ever become a > supported feature, no changes would be necessary for the cloning module. > > Furthermore, when using the vSphere API for Async tasks, it has it's own > queue and comes with it's own set of issues. Such as the queue filling, > tracking the many statuses it supports, additional network calls to get > status, implementing additional timeouts, etc. > > After I make and test this change, I will do a pull request... with the > assumption you believe this is a cleaner implementation. > > > Thanks, > -Corey > > > > > On Tue, Jul 8, 2014 at 5:30 PM, Michael DeHaan <[email protected]> wrote: > > Sounds like we'd be interested in taking a look at least, and a PR is a > good way to get that in the queue. I will admit now the queue is quite > longish as we're powering through things the best we can. > > I imagine if async is not used, it's a blocking operation, and the async > operation in ansible would be needed to use with it, and that might be > worth noting in docs? > > > > > On Tue, Jul 8, 2014 at 2:34 AM, Corey Gaffney <[email protected]> wrote: > > I have a vsphere_clone module I would like to contribute (amongst others). > My only concern is that I have added async support to the module since > this is part of PySphere functionality. This allows the use of a boolean > to indicate asynchronous vs synchronous(the default) in order to cooperate > with loops and nested loops in Ansible (which we all know do not support > Async at this point in time). In the spirit of keeping the functionality > of PySphere, I have kept this option available and find it quite powerful. > > Would this be acceptable, if yes.. then I will perform a pull request or > whatever is necessary to contribute. > > > Thanks, > Corey > > > > On Friday, April 19, 2013 5:36:47 PM UTC-5, Michael DeHaan wrote: > > Documentation was somewhat short at the time, we're talking about it now, > it's all good :) > > > > > On Fri, Apr 19, 2013 at 6:01 PM, Dag Wieers <[email protected]> wrote: > > On Fri, 19 Apr 2013, Michael DeHaan wrote: > > Ok, that's good. > > Out of curiosity, is kernel+initrd+commandline also possible? > > > I doubt vsphere can do that. > > > > These may be suitable for core inclusion, the above is not a prereq, but > it > would be nice if it could avoid a PXE environment (in case one already > existed and we wanted to ignore it). > > > That's why we use ISO media. It's the only common thing all > hardware/hypervisors can do properly. (ESX, KVM, iLO, RSA, RHEV) > > > > (I believe when I last asked they only did the ISO, or the playbooks that > referenced them required doing ISO builds.) > > > No, vsphere only did PXE because I never got the administrative rights on > vSphere to: > > 1. change the boot order > 2. have an NFS datastore or push images to another datastore > > You made conclusions based only on the examples I showed using ISO images. > And despite me mentioning that we use ISO just because it makes the most > sense in our environment. But PXE is supported for all *_boot modules (it > just isn't possible in heterogenous environments or disabled by security in > most large companies I have worked) > > If you looked at the module documentation it's clear you can do PXE with > all of them. (media=network) > > > -- > -- dag wieers, [email protected], http://dag.wieers.com/ > -- dagit linux solutions, [email protected], http://dagit.net/ > > > [Any errors in spelling, tact or fact are transmission errors] > > -- > 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 [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > Michael DeHaan <[email protected]> > > CTO, AnsibleWorks, Inc. > http://www.ansibleworks.com/ > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > > To view this discussion on the web visit https://groups.google.com/d/ms > gid/ansible-project/9e0fc804-8a2d-4923-bc32-feacb183c472%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/9e0fc804-8a2d-4923-bc32-feacb183c472%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit https://groups.google.com/d/to > pic/ansible-project/33hmOR301YI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ms > gid/ansible-project/CA%2BnsWgyyZt9RKyaHUOC5Ji%2BhCVsZswbkCe8 > TPSDo0PSoYg9K3Q%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyyZt9RKyaHUOC5Ji%2BhCVsZswbkCe8TPSDo0PSoYg9K3Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 [email protected]. > > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/2f18a176-4a1e-42de-85de-28056ce51b83%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/2f18a176-4a1e-42de-85de-28056ce51b83%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/ansible-project/33hmOR301YI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/CA%2BnsWgzA4TN_dX5eLciswrWQXUBk77% > 3DU1RSPn3UC5vPCOhAG_Q%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzA4TN_dX5eLciswrWQXUBk77%3DU1RSPn3UC5vPCOhAG_Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/CAK5UeTu4Nd%3DNVAXTcZ44Liv6jsCKF83LpDRtp8N > M_8OxK6FZnA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAK5UeTu4Nd%3DNVAXTcZ44Liv6jsCKF83LpDRtp8NM_8OxK6FZnA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/33hmOR301YI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/8f6fe9e8-ed97-4fba-82cf-429272968d6d%40googlegroups.com > > <https://groups.google.com/d/msgid/ansible-project/8f6fe9e8-ed97-4fba-82cf-429272968d6d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit > > ... -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9581d3c6-025f-4c0c-b099-0de87d80a7cd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
