profile for Gajendra D Ambi on Stack Exchange, a network of free, community-driven Q&A sites

Wednesday, January 3, 2018

Create json from powershell to deploy vCenter 6.5

So I have been working on generating a json file within powershell and then import it during the deployment of vcenter VCSA 6.5.


1
vcsa-deploy.exe install --accept-eula --no-esx-ssl-verify c:\vcsa.json

Above is how you deploy the vCSA. We have an automation portal which poops out pretty awesome automation scripts. I am however planning to use the variables from the web portal and generate the json. This is how you do it. We will end up using this in our future deployment of vCSA on vxracks, vxblocks and our other CI/HCI solutions of dell emc.


 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
$dnsServers = "" # dns servers separated by comma

$jsonRequest = [ordered]@{
    "target.vcsa" = @{
        "appliance" = @{            
            "deployment.network"="VM Network"
            "deployment.option"="infrastructure"
            "name"="vCenter-Server-Appliance"
            "thin.disk.mode"=$true }

        "esx"= @{
            "hostname"= "<ESXi host name or IP address>"
            "username"= "root"
            "password"= "<Password of the ESXi host root user>"
            "datastore"= "<ESXi host datastore>" }

        "network"= @{
            "hostname"= "<Host name>"
            "dns.servers"= "[$dnsServers]"
            "gateway"= "<Gateway IP address>"
            "ip"= "<Static IP address>"
            "ip.family"= "ipv4"
            "mode"= "static"
            "prefix"= "<The value must be 0-32>"  }


        "os"= @{
            "password"= "<vCenter Server Appliance root password>"
            "ssh.enable"=$true }

        "sso"= @{
            "password"= "<vCenter Single Sign-On password>"
            "domain-name"= "vsphere.local"
            "site-name"= "<SSO site name>" }
    }
}

$jsonPath = $PSScriptRoot +"\jsonVcsa.json"
$jsonData = $jsonRequest | ConvertTo-Json | Out-File $jsonPath -Force
$jsonData

This does creates a good json file. Hopefully I get to use it to deploy the vcenter. You want to check out william lam's blog for the same here https://www.virtuallyghetto.com/2016/12/how-to-automate-the-deployment-of-an-un-configured-vcsa-6-5-stage-1-only.html



No comments:

Post a Comment