Advertisement
Guest User

Untitled

a guest
Aug 7th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. #Deploy PSC using vCSA-Deploy
  2. # Convert JSON file to PowerShell object
  3. $ConfigLocation = "<location of custom JSON template files>"
  4. $Installer = "<ISO>\vcsa-cli-installer\win32\vcsa-deploy.exe"
  5. $UpdatedConfig = "C:\Temp"
  6. $domain = "<ad domain>"
  7. $vCenter_user = "<vCenter User>"
  8. $vCenter_password = "<vCenter User>"
  9. $sso_domain= "<vCenter SSO domain>"
  10. $sso_password="<password>"
  11. $sso_site = "<sso site>"
  12. $dnsserver = "<ip address>"
  13. $ip_gateway = "<ip address>"
  14. $datastore="<datastore>"
  15. $psc_password="<PSC Root Password>"
  16. $psc_primary="<server>"
  17. $psc_primary_ip="<ipaddress>"
  18. $psc_secondary="<server>"
  19. $psc_secondary_ip="<ip address>"
  20. $vCenterServer="<server>"
  21. $vmFolder="<folder>/<folder>"
  22. $cluster="<VM Cluster>"
  23. $portgroup="<VM vDS or vSS portgroup>"
  24. $vm_datacenter="<VMware Data Center>"
  25.  
  26.  
  27. Function DeployVCSA ([string] $machine, [string] $vCenter, [string] $role, [string] $primary ) {
  28.  
  29. Write-Host "Configuring $machine" -ForegroundColor Yellow
  30. $configfile = "$UpdatedConfig\$machine.cfg"
  31. Switch ($role)
  32. {
  33. "primary" { $file = "$configlocation\PSC_on_VC.json";}
  34. "replica" { $file = "$configlocation\PSC_replication_on_VC.json";}
  35.  
  36. Default {break}
  37. }
  38.  
  39. $json = (Get-Content -Raw $file) | ConvertFrom-Json
  40.  
  41. # vCenter Information
  42. $json."target.vcsa".vc.hostname="$vCenter.$domain"
  43. $json."target.vcsa".vc.username="$vCenter_user"
  44. $json."target.vcsa".vc.password= "$vCenter_password"
  45. $json."target.vcsa".vc.datacenter="$vm_datacenter"
  46. $json."target.vcsa".vc.datastore="$datastore"
  47. $json."target.vcsa".vc.target="$cluster"
  48. $json."target.vcsa".vc."vm.folder"="$vmfolder"
  49. # vCSA system information
  50. $json."target.vcsa".os.password="$psc_password"
  51. $json."target.vcsa".os."ssh.enable"=$true
  52. $json."target.vcsa".os."time.tools-sync"=$true
  53. # VCSA SSO information
  54. $json."target.vcsa".sso.password = "$sso_password"
  55. $json."target.vcsa".sso."site-name" = "$sso_site"
  56. $json."target.vcsa".sso."domain-name" = "$sso_domain"
  57. #VCSA Appliance Information
  58. $json."target.vcsa".appliance."deployment.option"="infrastructure"
  59. $json."target.vcsa".appliance."deployment.network"="$portgroup"
  60. $json."target.vcsa".appliance.name="$machine"
  61. $json."target.vcsa".appliance."thin.disk.mode"=$false
  62. # Networking
  63. $json."target.vcsa".network.hostname = "$machine.$domain"
  64. $json."target.vcsa".network.mode = "static"
  65. $json."target.vcsa".network.ip = "$psc_primary_ip"
  66. $json."target.vcsa".network."ip.family" = "ipv4"
  67. $json."target.vcsa".network.prefix = "24"
  68. $json."target.vcsa".network.gateway = "$ip_gateway"
  69. $json."target.vcsa".network."dns.servers"="$dnsserver"
  70.  
  71. if ($role -eq "replica") {
  72. $json."target.vcsa".sso."first-instance" =$false
  73. $json."target.vcsa".sso."replication-partner-hostname"="$primary.$domain"
  74. }
  75.  
  76.  
  77. $json | ConvertTo-Json | Set-Content -Path $configfile
  78.  
  79. Write-host "Deploying $machine" -ForegroundColor Yellow
  80.  
  81. Invoke-Expression "$installer $configfile --accept-eula"
  82.  
  83. If (Test-Path $configfile) {Remove-Item -path $configfile}
  84. }
  85.  
  86.  
  87. DeployVCSA $psc_primary $psc_primary_ip $vCenterServer "primary"
  88. DeployVCSA $psc_secondary $psc_secondary_ip $vCenterServer "replica" $psc_primary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement