Automation

 View Only
  • 1.  Deploy Linux VM from template with Guest Customization

    Posted Jul 12, 2013 03:23 PM

    Based on various forum postings and numerous articles i still haven't completely understood how to achieve the following scenario in a powercli script. any guidance is highly appreciated.

    Scenario:

    Linux Template - Name: LX-RHEL6x-template

    GuestCustomSpec: - Name: static-lx-nw

    Details:

    Linux Template is pre-configured with required HDDs and network adapters. Customization Specs is preconfigured with all settings and expects IP address for adapter1 and adapter 2 is set to DHCP. I have to deploy about 50 VMs in multiple different environments and am trying to script this to ease my deployments.

    deploy target:

    Cluster Name: QA

    Resource Pool: Normal

    Datastore: StrgCluster01

    Source:

    CSV file containing following details.

    VM-Name,IPADDR

    So far i have following script info from one of the discussion thread here however i am not sure how i can achieve the above using this script or how to modify it as i already have netmask etc. predefined in the customspecs.

    Import-Csv "C:\Uscripts\NewVMs.csv" -UseCulture | %{

        Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_.ip -SubnetMask $_.subnet -DefaultGateway $_.gw

        $vm=New-VM -Name $_.Name -Template $_.Template -Host $_.Host -Datastore $_.Datastore -Confirm:$false -RunAsync -OSCustomizationSpec $_.Customization

    }



  • 2.  RE: Deploy Linux VM from template with Guest Customization

    Posted Jul 12, 2013 04:35 PM

    At first sight that should work.

    The settings in the template will indeed be overrules by the ones in the OSCustomizationSpec.

    Do you have any errors or issues with the script ?