Baremetal provisioning on Windows Hyper-V

I’m very new to Ansible so please forgive me if I’m asking silly questions.

From what we’ve tested internally it seems that ansible nicely supports provisioning of virtual machines on the VMware host.

There seems to be no way of doing the same thing on Hyper-V 2012 though. This appears to be due to the lack of support by libvirt of this version of Hyper-V (looks like libvirt supports Hyper-V 2008).

I’m struggling to believe nobody out there in the ansible world is provisioning to Hyper-V 2012 and hasn’t hit this problem already.

How do people provision VM’s through ansible to Hyper-V 2012 please?

Thanks in advance.
Bryn

It’s honestly not something we get asked about much. There aren’t really many technical hurdles to doing so beyond, “we just don’t have the modules for it”. If somebody wanted to write one, there’s a good chance we’d accept it, but with all the other improvements needed in Windows-land over the next few releases, I wouldn’t expect to see Ansible/Red Hat building it anytime soon…

-Matt

Hi Matt,

Is there any update on this? If you supported provisioning vm on hyper v, it would be very useful :slight_smile:

Thanks,
Lars

Why not go the route of powershell from the Ansible control machine? Would the hyper-v module need to have feature parity with vmware module?

The other thing is that the VMWare module makes use of VCenter. Would the Hyper-V module need to make use of SCVMM?

Thanks for your reply.

I Use powershell now, and yes, it should connect to vmm.

Ok will have to build a vmm box to test that. So far I have the functionality to create,delete,restart,start and shutdown VM’s on a Hyper-V host.
I have the initial draft on https://github.com/mikef-nl/hyperv_guest . It will need additional testing before I’m happy it works fully. But thus far have been able to
add and delete VM’s on a Hyper-V host with no problem. Some extra error handling will need to follow and will probably end up creating a separate module for SCVMM following what the vmware modules have done.

I’ve still not heard a single request for it other than your initial one, so it’s not really high on our list of “things folks are clamoring for”…

Is there an official list of things folks are clamouring for in terms of windows modules Matt?

Is there an official list of things folks are clamouring for in terms of windows modules Matt?

Not really- I just talk with a lot of users at conferences and hear from our product folks about customer wishes… Determining our official stance on DSC is the biggest/most frequent thing I hear on the module side these days, so that will likely happen in 2.3 timeframe (whether we ship some version of what Trond’s been doing with DSC “in the box” or something else). We were blocked on Microsoft re-releasing the downlevel WMF5 installer long enough that it didn’t make it for the 2.2 roadmap.

A lot of little one-off “would be nice if I could XYZ” or enhancements to existing modules. Domain setup/management has been a pretty common one- we have a bunch of stuff we built for customers that just needs to be cleaned up (/support added for pre-2012 maybe). Fair number of requests for SQL Server stuff- hoping to build that on the new .NET Core SQL client so we could use the same module for Windows/Linux clients, since Microsoft’s SQL client will generally be better supported than an existing native Python open source client.

Matt,

I just wanted to chime in on this that i too would be interested in seeing Ansible support for Hyper-V. We utilize Hyper-V core for our test labs and i have been able to hack some work around with powershell to do VM creation and start up but its sloppy. I really wanted to use Ansible in conjunction with Stacki to provision VMs on the fly in Hyper-V but to use stacki, i need the mac addresses from the VMs but i cannot grab it as Ansible has no way that i can find to pull variables from nodes. I can grab the MAC with powershell, just no clena way to reference that :/. Im sure theres more hack-a-bout ways to fix this but its just getting too sloppy. +1 for ansible hyper-v support.

You could use the setup module with a facts directory holding your powershell to get the required info available to Ansible.

Good tip, i appreciate it.

Of course there are always hack around ways to get it done but it would be best if Ansible had Windows Hyper-V modules especially with Hyper-V gaining market share. Just looking / hoping for CRUD modules.

https://github.com/mikef-nl/hyperv_guest . I was toying with this, it’s a little rough around the edges so pull requests are welcome.

Looks cool, maybe Matt could build off of it :stuck_out_tongue:

A general rule of thumb of mine is i dont run code that i cannot read and i unfortunately have no python experience. I know there are a couple public hyper-v modules out there but i’m too weary to use them. Possibly installing a back door into your own environment, ya know?

Add me as a +1 for Hyper-V / SCVMM support.

We are a mixed VMware and Hyper-V shop. We looked at vRealize Automation (vRA) but it’s support for Hyper-V networking is lacking, therefore we cannot use it. I am also looking into Kelverion’s VM provisioning stack because they claim to be able to handle vCenter, SCVMM and “cloud” (AWS / Azure / OpenStack / etc)

Now that we’re shipping win_dsc in the box (2.4/devel), you might also want to have a look at the xHyperV DSC module…