Cain Manor

Your Guide To All Things Cain™

Mass provisioning of VM’s

We have a need to pro­vi­sion a bunch of Linux VM’s rel­a­tively quickly. We could do them by hand, but frankly, I’m too lazy to build 150 VM’s by hand. This is a very rough way to do it.

First you need a Cus­tomiza­tion Spec­i­fi­ca­tion filled out for each server. It’s entirely script­able, but I won’t be going into the details of that. This is what the Cus­tomiza­tion Spec­i­fi­ca­tion looks like

  <_type>vim.CustomizationSpecItem
 
    <_type>vim.CustomizationSpecInfo
    1274294433
    HandCodedVM1 
    2010-05-19T18:40:33Z
    HandCodedVM1
    Linux
 
    <_type>vim.vm.customization.Specification
 
      <_type>vim.vm.customization.GlobalIPSettings
 
        <_length>2
        <_type>string[]
        10.10.10.11
        10.10.10.12
 
        <_length>1
        <_type>string[]
        MyDomain.com
 
      <_type>vim.vm.customization.LinuxPrep
      sea1.com
 
        <_type>vim.vm.customization.FixedName
        HandCodedVM1
 
      true
      US/Pacific
 
      <_length>1
      <_type>vim.vm.customization.AdapterMapping[]
 
        <_type>vim.vm.customization.AdapterMapping
 
          <_type>vim.vm.customization.IPSettings
 
            <_length>2
            <_type>string[]
            10.10.66.1
 
            <_type>vim.vm.customization.FixedIp
            10.10.66.254
 
          255.255.254.0
 
      <_type>vim.vm.customization.LinuxOptions

I’m going to guess you know your envi­ron­ment well enough to rec­og­nize your DNS servers, your default gate­way, sub­net mask, the servers name, etc. Cus­tomize this file with the new set­tings you need. Once you have your new XML file, you’ll want to name it appro­pri­ately and import it into Vir­tual Cen­ter (I haven’t found a way to auto­mate that yet.)

Since that’s done, you just need to fire up Pow­er­Shell (I’m using Pow­er­Shell on the same box as my Vir­tual Cen­ter.) This too is script­able, but I haven’t writ­ten that script yet either. This is the rough frame­work you need to get started.

Connect-VIServer localhost (This connects you to the local VC.)
 
new-vm -name HandCodedVM1 -Template LINUX_TEMPLATE -OSCustomizationSpec HandCodedVM1 -VMHost HOST01 -Datastore OS01_NAS

Rel­a­tively easy to do, and it will save us a cou­ple of days over doing it manually.

Comments are closed.