Automated deployment of vRealize Automation 8.x via Powershell – Part 1

For my work, I regularly need to deploy a fresh vRA Environment, either to test with a specific (older) version or new beta release. Although the Deployment of vRA is relatively easy, it always takes me more time than I like, so I decided to throw in some extra time and automate the deployment of vRSLCM, VIDM and VRA. There are several options to do the automation, but it mainly comes down to scripting around the available API’s.

I decided to use PowerShell for scripting since I’m most familiar with this. Bear in mind that I am not a programmer, so some parts of my scripts may be further optimized and need additional error handling.

In Part 1 of this blog I will start with the Automated Deployment of vRSLCM.

My manual deployment workflow consists of downloading the Easy Installer ISO to my local drive. Then mount the ISO and run the installation. During the installation the ova files for VIDM and VRA are copied to the vRSLCM server.

For an automated deployment you cannot use the installer and you must make use of the vRSLCM ova that is inside the ISO file. This means the VIDM and VRA OVA files must be imported after deployment. Within vRSLCM there are 3 options to import install or upgrade files;

  • Copy the files to a directory on the VRSLCM Server
  • Copy the files from NFS
  • Download the files from MyVMware

Since I have a NAS in my homelab that can serve NFS, I decided to (make it optional to) copy both vidm and vra ova files to a NFS share in the script, so it can be picked up later during vRSLCM configuration in Part 2.

The deployment script itself is straight forward. You only need to configure the path to the Easy Installer iso and your specific environment variables. In outline the script does the following:

  • Mount the Easy Installer iso.
  • Set the ovf properties.
  • Deploy vRSLCM with the Import-VApp cmdlet.
  • Start the vRSLCM VM.
  • (Optionally) Copy the vidm and vra ova files to your NFS share.
  • Unmounts the Easy Installer iso.

After successful deployment, have a look at Part 2 which is all about the automated configuration of vRSLCM and the deployment of vidm and vRA.

You can find the script below or you find the latest up to date version of the script “vRSLCM-Deployments.ps1” from my [Github] repository.

# Deploy vRSLCM
#   Optional copy vidm and vra files to NFS share
# Henk Engelsman
# 14 Aug 2021

# Path to EasyInstaller ISO
$vrslcmIso = "<path to iso file>" #"C:\Temp\vra-lcm-installer-18067628.iso"
$copyOVA = $true #Select $true or $false to copy vra and vidm files to a NFS Share
$nfsshare = "<path to NFS share>" #"\\\data\iso\vRealize\vRA8\latest\"
#vcenter variables
$vcenter = "<vcenter FQDN>" #vcsamgmt.infrajedi.local"
$vcUser = "administrator@vsphere.local"
$vcPassword = "<password>"
# General Configuration Parameters
$cluster = "cls-mgmt"
$network = "VMNet1"
$datastore = "<Datastore Name>"
$vrslcmIp = "<vRSLCM IP Address>"
$netmask = "<subnetmask>"
$gateway = "<gateway>"
$dns = "<dns1,dns2>" #DNS Servers, Comma separated ","
$domain = "<dns domain name>" # infrajedi.local
$vrslcmVmname = "vrslcm" #vRSLCM VM Name
$vrslcmHostname = $vrslcmVmname+"."+$domain #joins vmname and domain to generate fqdn
$vrlscmPassword = "VMware01!" #Note this is the root password, not the admin@local password
$ntp = "<ntpserver>"
$vmFolder = "<vCenter VM Foldername>" #VM Foldername to place the vm

#Mount the Iso and extract ova paths
$mountResult = Mount-DiskImage $vrslcmIso -PassThru
$driveletter = ($mountResult | Get-Volume).DriveLetter
$vrslcmOvaFileName = (Get-ChildItem ($driveletter + ":\" + "vrlcm\*.ova")).Name
$vrslcmOva = $driveletter + ":\vrlcm\" + $vrslcmOvaFileName
$vidmOva = $driveletter + ":\" + "ova\vidm.ova"
$vraOva = $driveletter + ":\" + "ova\vra.ova"
#Or Remark the above and configure the path to the vRLCM ova file below
#$vrslcmOva = "D:\vrlcm\VMware-vLCM-Appliance-"

#connect to vCenter
Connect-VIServer $vcenter -User $vcUser -Password $vcPassword -WarningAction SilentlyContinue
$vmhost = get-cluster $cluster | Get-VMHost | Select-Object -First 1

#vRSLCM OVF Configuration Parameters
$ovfconfig = Get-OvfConfiguration $vrslcmOva
$ovfconfig.Common.vami.hostname.Value = $vrslcmHostname
$ovfconfig.Common.varoot_password.Value = $vrlscmPassword
$ovfconfig.Common.va_ssh_enabled.Value = $true
#$ovfconfig.Common.va_firstboot_enabled.Value = $true #default is $true
$ovfconfig.Common.va_telemetry_enabled.Value = $false
$ovfconfig.Common.va_fips_enabled.Value = $false
$ovfconfig.Common.va_ntp_servers.Value = $ntp
#start optional certificate settings
#$ovfconfig.Common.vlcm.cert.commonname.Value = $vrslcmHostname
#$ovfconfig.Common.vlcm.cert.orgname.Value = "infrajedi"
#$ovfconfig.Common.vlcm.cert.orgunit.Value = "local"
#$ovfconfig.Common.vlcm.cert.countrycode.Value = "NL"
#end optional certificate settings
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.gateway.Value = $gateway
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.domain.Value = $domain
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.searchpath.Value = $domain
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.DNS.Value = $dns
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.ip0.Value = $vrslcmIp
$ovfconfig.vami.VMware_vRealize_Suite_Life_Cycle_Manager_Appliance.netmask0.Value = $netmask
$ovfconfig.IpAssignment.IpProtocol.Value = "IPv4" #string["IPv4", "IPv6"]
$ovfconfig.NetworkMapping.Network_1.Value = $network

#Deploying vRSLCM OVA
Write-Host "Start Deployment of VRSLCM"
$vrslcmvm = Import-VApp -Source $vrslcmOva -OvfConfiguration $ovfconfig -Name $vrslcmVmname -Location $cluster -InventoryLocation $vmFolder -VMHost $vmhost -Datastore $datastore -DiskStorageFormat thin

#Start vRSLCM VM
Write-Host "Start VRSLCM VM"
$vrslcmvm | Start-Vm -RunAsync | Out-Null
#Note the admin@local password defaults to "vmware"

#Disconnect vCenter
Disconnect-VIServer $vcenter -Confirm:$false

#Copy OVA files to NFS Share if selected
if ($copyOVA -eq $true){
    Write-Host "VIDM and vRA OVA Files will be copied to $nfsshare"
    Start-BitsTransfer -source $vidmOva -Destination $nfsshare
    Start-BitsTransfer -source $vraOva -Destination $nfsshare
elseif ($copyOVA -eq $false) {
    Write-Host "Skip copying VIDM and vRA OVA Files to NFS"

#Unmount ISO
DisMount-DiskImage $vrslcmIso -Confirm:$false |Out-Null

Henk Engelsman

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment