vCenter 7 Deployment Using CLI and vCenter Installation Automation

You can make silent deployment for the vCenter appliance in an ESXi host using the command line. The deployment will include:

  • vCenter media file download
  • Preparing  JSON file with the deployment configuration parameters
  • Run the deployment command.

In this LAB, we copied the downloaded installation media files to a folder named “vCenter.”

  • The location of JSON file is : “D:\vcenter\vcsa-cli-installer\templates\install \embedded_vCSA_on_ESXi.json”
  • The location of deployment command is : “D:\vcenter\vcsa-cli-installer\win32 \vcsa-deploy.exe”

To deploy the vCenter appliance in an ESXi server, we first need to edit the JSON file to add all the required configuration parameters. It is preferred to do that with a code editor. We will copy the JSON file from the vCenter installation media to another folder and begin editing the file and insert the required configuration parameter.

Editing The JSON file :

We will edit the JSON file to add the deployment required configuration parameters. The JSON file consists of the sections each contains part of the required deployment information:

The following is the JSON file after editing with the required configuration parameters:

{
“__version”: “2.13.0”,
“__comments”: “Sample template to deploy a vCenter Server Appliance with an embedded Platform Services Controller on an ESXi host.”,
“new_vcsa”: {
“esxi”: {
“hostname”: “192.168.1.65”,
“username”: “root”,
“password”: “P@ssw0rd”,
“deployment_network”: “VM Network”,
“datastore”: “data”
},
“appliance”: {
“__comments”: [
“You must provide the ‘deployment_option’ key with a value, which will affect the vCenter Server Appliance’s configuration parameters, such as the vCenter Server Appliance’s number of vCPUs, the memory size, the storage size, and the maximum numbers of ESXi hosts and VMs which can be managed. For a list of acceptable values, run the supported deployment sizes help, i.e. vcsa-deploy –supported-deployment-sizes”
],
“thin_disk_mode”: true,
“deployment_option”: “tiny”,
“name”: “vcenter-server”
},
“network”: {
“ip_family”: “ipv4”,
“mode”: “static”,
“system_name”: “vcenter12.adatum.com”,
“ip”: “192.168.1.180”,
“prefix”: “24”,
“gateway”: “192.168.1.1”,
“dns_servers”: [
“192.168.1.80”
]
},
“os”: {
“password”: “P@ssw0rd”,
“ntp_servers”: “time.google.com”,
“ssh_enable”: false
},
“sso”: {
“password”: “P@ssw0rd”,
“domain_name”: “vsphere.local”
}
},
“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
}
}
}
JSON File

We will save the JSON file, and then we will run the deployment command.

The Deployment Command:

Before running the deployment command, create a vCenter DNS record with PTR; otherwise, the deployment will fail. If you do not need to configure the DNS, you must supply the IP instead of a hostname (FQDN name).

The Deployment Command

$DeploymentCommandFolder=”D:\vcenter\vcsa-cli-installer\win32”
$jsonFile= “D:\vcenter\vcsa-cli-installer\templates\install\embedded_vCSA_on_ESXi.json”
cd $DeploymentCommandFolder
.\vcsa-deploy.exe install –accept-eula –acknowledge-ceip –no-ssl-certificate-verification $jsonFile
We will write these commands in PowerShell ISE and save them as vCenterDeployment.ps1, which we can later run as PowerShell script.

vCenter Installation Automation :

In this case, we will use the PowerShell command to convert the JSON file parameters into PowerShell objects that can be edited in the PowerShell:
$json = (Get-Content -Raw $jsonFile) | ConvertFrom-Json
This allows us to directly update the JSON file parameters in the PowerShell Script every time we need to make a custom installation; after we add all the required deployment information, we will convert the edited JSON parameters back to the original JSON file or other JSON file saved in a new location – to keep installation media with the default values. In this LAB, we updated values to a new JSON file named d:\configuration.JSON
$updatedjson = “D:\configuration.json”
$json = (Get-Content -Raw $jsonFile) | ConvertFrom-Json
The entire automation script will be as the following:

# Deployment command folder:

$DeploymentCommandFolder=”D:\vcenter\vcsa-cli-installer\win32”

# JSON file location:
$jsonFile= “D:\vcenter\vcsa-cli-installer\templates\install\embedded_vCSA_on_ESXi.json”

#Updated JSON File Location:

$updatedjson = “D:\configuration.json”
Convert JSON file to PowerShell:
$json = (Get-Content -Raw $jsonFile) | ConvertFrom-Json

# ESXi Configuration information:

$json.new_vcsa.esxi.hostname=”192.168.1.65″
$json.new_vcsa.esxi.username=”root”
$json.new_vcsa.esxi.password=”P@ssw0rd”
$json.new_vcsa.esxi.deployment_network=”VM Network”
$json.new_vcsa.esxi.datastore= “data”

# Appliance configuration Parameters:

$json.new_vcsa.appliance.thin_disk_mode=Thin
$json.new_vcsa.appliance.deployment_option=”tiny”
$json.new_vcsa.appliance.name=”vcenter-server”

# Appliance Network configuration Parameter:

$json.new_vcsa.network.ip_family=”ipv4″
$json.new_vcsa.network.mode=”static”
$json.new_vcsa.network.system_name=”vcenter12.adatum.com”
$json.new_vcsa.network.ip=”192.168.1.180″
$json.new_vcsa.network.prefix=”24″
$json.new_vcsa.network.gateway=”192.168.1.1″
$json.new_vcsa.network.dns_servers=”192.168.1.80″


# Appliance OS Configuration Paramter:

$json.new_vcsa.os.password=”P@ssw0rd”
$json.new_vcsa.os.ntp_servers=”time.google.com” or “216.239.35.4”
$json.new_vcsa.os.ssh_enable= false

# Appliance system Domain Paramter:

$json.new_vcsa.sso.domain_name=”vsphere.local”
$json.new_vcsa.sso.password=”P@ssw0rd”

# CEIP Configuration:

$json.ceip.settings.ceip_enabled= false

# Convert PowerShell Parameter to JSON (Updated JSON file location):

$json | ConvertTo-Json | Set-Content -Path $updatedjson

# Deployment Command:

cd $DeploymentCommandFolder
.\vcsa-deploy.exe install –accept-eula –acknowledge-ceip –no-ssl-certificate-verification $updatedjson
: