Upgrading vCSA 6.7 to 7.0 via CLI

In my current project I have been tasked with identifying the process of VCSA upgrade via CLI so that same can be automated via code and eventually enabling customers to upgrade vCenter server in one click.

During my research I came to know that unfortunately there are no API calls as of now to upgrade vcsa and we have to rely on the CLI installer method. 

vCenter Upgrade Process Overview

Those who have worked on VCSA upgrade in past, VCSA upgrade is not an in-place upgrade and it is a 2 step process.

  • Stage1 is where you gather all the necessary information such as source and target appliance details, target Esxi host/vCenter to deploy appliance and vCenter credentials etc. A new appliance with target version is deployed during the process.
  • In Stage2 data (configuration, historical, and performance metrics) migration is performed from source VCSA to newly deployed VCSA.

During upgrade, the newly deployed appliance is deployed via a temporary IP and once all data is migrated from source appliance, it is shut down and the new appliance is reconfigured with same IP which was configured in source. 

Note: Depending upon amount of historical data stored in source appliance and data you choose to migrate during stage 2, upgrade can take some time.

Important: Before starting VCSA upgrade, make sure you have taken the backup (native vcsa or 3rd party). On a safer side you can take snapshot also before performing upgrade. 

Now lets dive into lab and see CLI magic in action.

VCSA Install/Upgrade via CLI is performed via feeding a template file in json format. Information about various json templates available is mentioned in VMware official documentation.

You can find the template files available in VCSA installation media. Once VCSA iso is extracted, navigate to directory <basedir>\VMware-VCSA-all-xxxx\vcsa-cli-installer\templates\upgrade\vcsa6.7. 

Following templates are available. Pick the one which suits your infrastructure. 

vcsa-upgrade-templates.JPG

In my environment I used embedded_vCSA_on_VC template (as I have PSC and VC deployed in same appliance). I have modified the original template and removed comments in order to shorten the template file. My json file look like below.

Once you have formatted your JSON, verify the configuration of json file by firing below command:

<base-dir>/vcsa-cli-installer/lin64/vcsa-deploy /data/runtime/vcsa-upgrade-new.json –accept-eula –no-ssl-certificate-verification –verify-template-only

If no issues encountered during template verification, you will see this message on your screen, which suggests that json is good to go for starting upgrade.

Next is to perform upgrade pre-check, so that if any issues are reported during pre-check, it can be remediated before kicking actual upgrade.

<base-dir>/vcsa-cli-installer/lin64/vcsa-deploy upgrade <path-to-json>/vcsa-upgrade-new.json –accept-eula –no-ssl-certificate-verification –precheck-only

Once upgrade pre-check is successful, run below command to start actual upgrade process.

<base-dir>/vcsa-cli-installer/lin64/vcsa-deploy upgrade <path-to-json>/vcsa-upgrade-new.json –no-ssl-certificate-verification –accept-eula

This command starts the upgrade process and it will run until it either fails or succeeds.

And that’s it for this post.

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing:)