Why upgrade via CLI?
Most of us are familiar with upgrading using the GUI installer, but did you know you can perform the same upgrade via the command line? This means you can automate the install using unattended .json templates, which is handy if you have a lot of vCenter's to upgrade, or you just want to show off to your colleagues :-)
Pre-requisites
This guide runs through the upgrade of the VCSA version of vCenter using the CLI installer method. This is nice, because you can see exactly what is happening at every step of the upgrade, and gain a better understanding of the install/upgrade process.
This guide also assumes you have a healthy vCenter to begin with
Note that the upgrade process deploys a completely new vCenter appliance, then connects to the old vCenter and migrates the data to the new vCenter. After which it migrates the network settings, and powers the old vCenter VM off.
Pre-Upgrade Actions
Patch your 6.7 vCenter to the latest build (currently Update 3s version 6.7.0.54000). This ensures the latest patches and bugfixes are installed prior to upgrade
Ensure you have good backups - Either using the VAMI based backup mechanism, and/or, power your vCenter off, take a snapshot, and power it back on again. If you are running in Linked Mode, you will need to power off ALL vCenters and snapshot them, then power them all back on, prior to upgrade. This ensures you have a consistent point in time restore point for all vCenters
Ensure your vCenter is healthy and has sufficient disk space. Check for any alerts and log into the VAMI (https://vc-ip:5480) to check the health status before upgrading.
Download vCenter ISO
The first thing you will need is the vCenter 7 ISO. You can download this from your VMware Portal on a 60 day evaluation license (even if you're existing licences are for 6.7), but in my case i used my VMUG Advantage subscription which gives me access to VMware products with license keys as i am doing this in my homelab. The ISO provided by my VMUG subscription is shown below:
Filename: VMware-VCSA-all-7.0.3-20990077.iso
The build number 20990077 corresponds to vCenter 7.0 Update 3J. You can cross reference vCenter builds and versions here → Build numbers and versions of VMware vCenter Server
Install vCenter
Mount the ISO
Navigate to the following directory
Copy the file called "embedded_vCSA_on_ESXi.json" to C:\temp
Open the file with an appropriate editor. VSCode is good as it adds colour coding to the syntax, or you can use Notepad++ or your favourite editor.
Here's my sample json script after editing it! Note i have stripped out some of the comments for brevity. Also note that if you leave the passwords blank, you will be prompted for them during the installation process.
{
"__version": "2.13.0",
"__comments": "Sample template to upgrade a vCenter Server Appliance 6.7 with an embedded Platform Services Controller to a vCenter Server Appliance 7.0 with an embedded Platform Services Controller.",
"new_vcsa": {
"esxi": {
"hostname": "192.168.68.51",
"username": "root",
"password": "VMware1!",
"deployment_network": "VM Network",
"datastore": "VM02-SYNOLOGY"
},
"appliance": {
"thin_disk_mode": true,
"deployment_option": "tiny",
"name": "VC-7"
},
"os": {
"ssh_enable": true
},
"temporary_network": {
"ip_family": "ipv4",
"mode": "static",
"ip": "192.168.68.72",
"prefix": "24",
"gateway": "192.168.68.1",
"dns_servers": "192.168.68.40"
},
"user_options": {
"vcdb_migrateSet": "all"
}
},
"source_vc": {
"managing_esxi_or_vc": {
"hostname": "192.168.68.61",
"username": "root",
"password": "VMware1!"
},
"vc_vcsa": {
"hostname": "vc.homelab",
"username": "administrator@vsphere.local",
"password": "VMware1!",
"root_password": "VMware1!"
}
},
"ceip": {
"settings": {
"ceip_enabled": true
}
}
}
Start a command prompt and navigate to D:\vcsa-cli-installer\win32.
Run the command vcsa-deploy --help to see the available commands
Run the following command to verify the template.
.\vcsa-deploy.exe upgrade --accept-eula --no-ssl-certificate-verification --verify-template-only C:\Temp\embedded_vCSA_on_ESXi.json
Examine the output for any errors and fix accordingly.
Now run the following pre-check command
vcsa-deploy.exe upgrade --accept-eula --no-ssl-certificate-verification --precheck-only --acknowledge-ceip C:\Temp\embedded_vCSA_on_ESXi.json
Monitor the output and examine for any errors. I won't post the full extract, but what we're looking for here is a SUCCEEDED message on the final pre-checks
Now we can run the unattended upgrade
vcsa-deploy.exe upgrade --accept-eula --no-ssl-certificate-verification --acknowledge-ceip C:\Temp\embedded_vCSA_on_ESXi.json
The upgrade begins......
The installation provides feedback to the console indicating progess. Here you can see RPMs being installed
The deployment completes successfully. You can see here the tasks for importing the data completing and an advisory that the new vCenter is currently in evaluation mode.
If you log into your vCenter (using the same hostname or IP address as before, you can see the new vCenter 7.0 appliance is now running, and the vCenter 6.7 appliance is now powered off.
Also note the presence of the 2 x vCLS VMs which are a new feature introduced in vSphere 7.0 Update 1. You can read more about them here
Conclusion
And there you have it, how to perform an unattended upgrade of vCenter. You can of course use tools like Ansible or Terraform to deploy vCenter, but that's an article for another day!
Comments