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-xxxxvcsa-cli-installertemplatesupgradevcsa6.7.
Following templates are available. Pick the one which suits your infrastructure.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
{ "__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 on a vCenter Server instance.", "new_vcsa": { "vc": { "hostname": "vc.cloud.vmw", "username": "administrator@vsphere.local", "password": "VMware123!", "deployment_network": "VM_MGMT", "datacenter": "MGMT_DC", "datastore": "vsanDatastore", "target":"MGMT_CLU" }, "appliance": { "thin_disk_mode": true, "deployment_option": "small", "name": "vCSA-7.0" }, "os": { "ssh_enable": true }, "temporary_network": { "ip_family": "ipv4", "mode": "static", "ip": "192.168.105.60", "dns_servers": "192.168.101.5", "prefix": "24", "gateway": "192.168.105.1" }, "user_options": { "vcdb_migrateSet": "all" } }, "source_vc": { "managing_esxi_or_vc": { "hostname": "esxmb2.cloud.vmw", "username": "root", "password": "Skoda1!" }, "vc_vcsa": { "hostname": "vc.cloud.vmw", "username": "administrator@vsphere.local", "password": "VMware123!", "root_password": "VMware123!" } }, "ceip": { "settings": { "ceip_enabled": false } } } |
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.
1 2 3 4 5 6 7 8 9 |
=============================================== [START] Start executing Task: To validate the template structure against the rules specified by a corresponding template schema. at 14:20:44 =============================================== Template structure validation for template '/data/runtime/vcsa-upgrade-new.json' succeeded. Structure validation for all templates succeeded. ======================================= [SUCCEEDED] Successfully executed Task 'StructureValidationTask: Executing Template Structure Validation task' in TaskFlow 'template_validation' at 14:20:44 ======================================= [START] Start executing Task: To create a dependency graph for the provided templates, with an edge pairing two templates that are dependent on each other. Such graph relationships will affect whether certain templates can be deployed in parallel, or must be deployed sequentially. at 14:20:44 Dependency processing for all templates succeeded. ====================================== [SUCCEEDED] Successfully executed Task 'DependencyProcessingTask: Executing Template Dependency Processing task' in TaskFlow 'template_validation' at 14:20:44 ====================================== Template verification completed. |
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