Deploy vCSA 6.5 with PowerShell!

I posted a while back on a scripted deployment of the vCenter Server Appliance 6.0. I found the scripted method where PowerShell is leveraged to execute a .json script to be superior to the GUI-based method of deploying the vCSA, especially if multiple vCSAs need to be deployed.

The method of deploying the vCSA 6.5 via PowerShell is a little different than the method of deploying the vCSA 6.0, in that the .json script is slightly different, and the PowerShell command is different as well. In my opinion, it’s been simplified a bit.

TheĀ  .json script is included in the ISO for the vCSA at E:\vcsa-cli-installer\templates. You can use the script from the relevant deployment type you’re going to do; you can browse to install, upgrade, or migrate templates. From there, you can also select between templates for the relevant vCenter topology you’re going to use. I’ve included the .json template for installing an embedded vCSA on ESXi below; you’d use this in a situation wherein you are either deploying a brand new vCSA in a greenfield deployment, or you are replacing an existing vCenter, but either can’t upgrade it, or don’t wish to.

Open the .json template in your preferred text editor. Start at “esxi” and add in your relevant configurations in the areas bracketed <> off.

Be sure that you’ve already completed the prerequisites of deploying the vCSA: The big one is having a DNS entry for the vCSA to resolve its IP into a FQDN and vice versa.

{
“__version”: “2.3.1”,
“__comments”: “Sample template to deploy a vCenter Server Appliance with an embedded Platform Services Controller on an ESXi host.”,
“new.vcsa”: {
“esxi”: {
“hostname”: “<FQDN or IP address of the ESXi host on which to deploy the new appliance>”,
“username”: “root”,
“password”: “<Password of the ESXi host root user. If left blank, or omitted, you will be prompted to enter it at the command console during template verification.>”,
“deployment.network”: “VM Network”,
“datastore”: “<A specific ESXi host datastore, or a specific datastore in a datastore cluster.>”
},
“appliance”: {
“thin.disk.mode”: true,
“deployment.option”: “small”,
“name”: “Embedded-vCenter-Server-Appliance”
},
“network”: {
“ip.family”: “ipv4”,
“mode”: “static”,
“ip”: “<Static IP address. Remove this if using dhcp.>”,
“dns.servers”: [
“<DNS Server IP Address. Remove this if using dhcp.>”
],
“prefix”: “<Network prefix length. Use only when the mode is ‘static’. Remove if the mode is ‘dhcp’. This is the number of bits set in the subnet mask; for instance, if the subnet mask is 255.255.255.0, there are 24 bits in the binary version of the subnet mask, so the prefix length is 24. If used, the values must be in the inclusive range of 0 to 32 for IPv4 and 0 to 128 for IPv6.>”,
“gateway”: “<Gateway IP address. Remove this if using dhcp.>”,
“system.name”: “<FQDN or IP address for the appliance. Remove this if using dhcp.>”
},
“os”: {
“password”: “<Appliance root password; refer to –template-help for password policy. If left blank, or omitted, you will be prompted to enter it at the command console during template verification.>”,
“ssh.enable”: false
},
“sso”: {
“password”: “<vCenter Single Sign-On administrator password; refer to –template-help for password policy. If left blank, or omitted, you will be prompted to enter it at the command console during template verification.>”,
“domain-name”: “vsphere.local”,
“site-name”: “<vCenter Single Sign-On site name>”
}
},
“ceip”: {
“description”: {
“__comments”: [
“++++VMware Customer Experience Improvement Program (CEIP)++++”,
“VMware’s Customer Experience Improvement Program (CEIP) “,
“provides VMware with information that enables VMware to “,
“improve its products and services, to fix problems, “,
“and to advise you on how best to deploy and use our “,
“products. As part of CEIP, VMware collects technical “,
“information about your organization’s use of VMware “,
“products and services on a regular basis in association “,
“with your organization’s VMware license key(s). This “,
“information does not personally identify any individual. “,
“”,
“Additional information regarding the data collected “,
“through CEIP and the purposes for which it is used by “,
“VMware is set forth in the Trust & Assurance Center at “,
http://www.vmware.com/trustvmware/ceip.html . If you “,
“prefer not to participate in VMware’s CEIP for this “,
“product, you should disable CEIP by setting “,
“‘ceip.enabled’: false. You may join or leave VMware’s “,
“CEIP for this product at any time. Please confirm your “,
“acknowledgement by passing in the parameter “,
“–acknowledge-ceip in the command line.”,
“++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++”
]
},
“settings”: {
“ceip.enabled”: true
}
}
}

Be sure to save the template to a location you can access, and save it as .json.

Then, with the ISO still mounted, launch PowerShell as admin, cd to <Install Drive>:\vcsa-cli-installer\<relevant OS> and run the following command:

.\vcsa-deploy.exe install –no-esx-ssl-verify –accept-eula –acknowledge-ceip “C:\Path\To\Your\vCSA.json”

PowerShell will deploy the vCSA and give you status updates as the rpm is deployed, as services are started, etc.

In all, like I said, this is a much easier way to deploy vCSA 6.5 than using the GUI. It’s also a good introduction to scripting.

 

Enjoy!

Repointing an Embedded VCSA 6.0 to an External PSC (with a wrinkle)

So, I am studying for the VCAP6 DCV Deploy exam (which is currently scheduled for a week from now) and I am testing repointing an embedded VCSA to an external PSC in my lab. I have deployed a vCenter Server Appliance 6.0 using PowerCLI and the full_conf.json script provided on the ISO. Then I deployed a VCSA PSC using a script too.

Then I went to repoint the VCSA to the PSC. I opened an SSH session to the VCSA.

I ran the following commands.

Command> shell.set –enabled True

Command> shell

Test-VC07:~ # cmsso-util reconfigure –repoint-psc test-psc01.lab.local –username administrator –domain-name lab-vsphere.local –passwd Password123!

And then I received the following message:

cmssoerror1

I Googled the error and found a few KBs and community posts indicating the issue might lie with the case-sensitive nature of the command. Perhaps DNS had my PSC name IN ALL CAPS! So I looked, and as I suspected, the DNS entry was all in lower-case. So, I verified the PNID of the PSC appliance. I SSH’d to the PSC, and ran the following command and received the output:

test-psc01:~ # /usr/lib/vmware-vmafd/bin/vmafd-cli get-pnid –server-name localhost

test-psc01.lab.local

So the issue wasn’t with case-sensitivity. Some further Googling suggested setting up replication between the VCSA and the PSC using vdcrepadmin. So, I went back to my SSH session with the VCSA and ran the following command:

Test-VC07:~ # /usr/lib/vmware-vmdir/bin/vdcrepadmin -f createagreement -2 -h test-vc07.lab.local -u administrator -w Password123! -H test-psc01.lab.local

Then I tried re-running the cmsso-util command on my VCSA. And it worked!

cmssoerror2.PNG

The only thing I can determine is that perhaps, even though I deployed both VCSA nodes to the same SSO domain and the same site, perhaps there was some interference on the network side. Either way, I got it working.

On logging into the VCSA now, I receive the following message:

cmssoerror3

 

So, if you encounter the same issue I did, perhaps this will help you get around it.

vWebster