Automated Linux VMs on Hyper-V 2012
Posted
by
Mick
on Server Fault
See other posts from Server Fault
or by Mick
Published on 2013-07-01T08:47:12Z
Indexed on
2013/07/01
10:23 UTC
Read the original article
Hit count: 262
I have a requirement to create a ton of linux VMs for our customers (we run managed infrastructure) on Hyper-V 2012 in the coming months and I have an issue with automating it.
Here is how I need it to work:
- User accesses their web page and creates a VM.
- VM is created with a unique IP and name
- User logs in over SSH
I know Hyper-V quite well and can work with powershell and am a C# programmer so the development side of things is taken care of. I also know enough about Linux to be at least competent: I have used it on and off for a number of years but not done anything Enterprise-level with it.
All this can be done easily by manual processes but I need to be able to script or program this to automate it as there could be hundreds of them being created but I don't know how.
My first thought is to have a database with random-generated names and IPs already created but I don't know how to get a Linux VM to boot up and grab one from the database... I suppose a Kickstart script would take care of it but I don't know what to do from there.
Here is what is bouncing around in my head:
- Create a std linux build. - Easy to do
- Someone clicks "Create VM" and I pull a name and IP from the database and write it to a kickstart script. - Easy to do
- I could then open the template VHDX file and copy in the script and then save it. - Not sure if possible
- User boots up new VM and the kickstart script gives it the name and IP I assigned it.
My problem is that I don't know how to open a VHDX file and insert a kickstart script into it... can't figure it out.
I am reaching here and this solution may be miles off... I am more used to creating Windows VMs with scripts and so on which i am more familiar with... any help would be appreciated.
Thanks
Mick
© Server Fault or respective owner