Skip to content

Instantly share code, notes, and snippets.

@thecloudxpert
Last active July 25, 2016 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thecloudxpert/aa4af7a0f956bc700692b3726186f3a2 to your computer and use it in GitHub Desktop.
Save thecloudxpert/aa4af7a0f956bc700692b3726186f3a2 to your computer and use it in GitHub Desktop.
# Deploy vCSA6 using vCSA-Deploy
# Convert JSON file to PowerShell object
$TMP = Read-Host -Prompt "Enter the location of the JSON Template:"
$ISO = Read-Host -Prompt "Enter the Root folder for ISO (i.e. d:\temp):"
$CFG = Read-Host -Prompt "Enter the location for the new configuration file:"
$SSOPassword = Read-Host -Prompt "Enter the SSO Administrator Password:"
$PSCPassword = Read-Host -Prompt "Enter the PSC Root Password:"
$VCServer = Read-Host -Prompt "Enter the FQDN of the target vCenter server:"
$VCUsername = Read-Host -Prompt "Enter the name of the vCenter User:"
$VCPassword = Read-Host -Prompt "Enter the vCenter User Password:"
$Installer = "$ISO\vcsa-cli-installer\win32\vcsa-deploy.exe"
$ConfigLoc = "$TMP\PSC_on_VC.json"
$UpdatedConfig = "$CFG\configuration.json"
$json = (Get-Content -Raw $ConfigLoc) | ConvertFrom-Json
# VC Host Information
$json."target.vcsa".vc.hostname="$VCServer"
$json."target.vcsa".vc.username="$VCUsername"
$json."target.vcsa".vc.datacenter="<virtual data center>"
$json."target.vcsa".vc.password="$VCPassword"
$json."target.vcsa".vc.datastore="<vmware datastore>"
$json."target.vcsa".vc.target="<cluster name>"
$json."target.vcsa".vc."vm.folder"="<vmfolder>/<vmfolder>"
# vCSA system information
$json."target.vcsa".os.password="$PSCPassword"
$json."target.vcsa".os."ssh.enable"=$false
$json."target.vcsa".os."time.tools-sync"=$true
# VCSA SSO information
$json."target.vcsa".sso.password = $SSOPassword
$json."target.vcsa".sso."site-name" ="<sso site>"
$json."target.vcsa".sso."domain-name" ="<sso domain>"
# Appliance Information
$json."target.vcsa".appliance."deployment.option"="infrastructure"
$json."target.vcsa".appliance."deployment.network"="<port group>"
$json."target.vcsa".appliance.name="<vm display name>"
$json."target.vcsa".appliance."thin.disk.mode"=$false
# Networking
$json."target.vcsa".network.hostname = "<psc fqdn>"
$json."target.vcsa".network.mode = "static"
$json."target.vcsa".network.ip = "<ip address>"
$json."target.vcsa".network."ip.family" = "ipv4"
$json."target.vcsa".network.prefix = "24"
$json."target.vcsa".network.gateway = "<ip gateway>"
$json."target.vcsa".network."dns.servers"="<dns server>,<dns server>"
$json | ConvertTo-Json | Set-Content -Path "$UpdatedConfig"
Invoke-Expression "$installer $UpdatedConfig --accept-eula"
# Delete config file with all passwords in it!
If (Test-Path $UpdatedConfig) {Remove-Item -path $UpdatedConfig}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment