]

Solution

  • Automation

Category

  • VCF Operational Guidance

Product

  • Cloud Foundation

Automating VCF - Deploy Management Domain

In this part of the series, we take a look at how to deploy the Management Domain using VMware Cloud Builder.

The first step would typically be to download and populate the Deployment Parameters Workbook that is provided as part of VMware Cloud Builder, but in this series of blog posts we are going to generate everything we need using the new Planning and Preparation Workbook.

VMware Cloud Builder APIs Used

  • POST /v1/sddcs/validations
  • GET /v1/sddcs/validations/{id}
  • POST /v1/sddcs
  • GET /v1/sddcs/validations/{id}

PowerVCF Cmdlets

  • Connect-CloudBuilder
  • Start-CloudBuilderSDDCValidation
  • Get-CloudBuilderSDDCValidation
  • Start-CloudBuilderSDDC
  • Get-CloudBuilderSDDC

PowerShell Scripts

Procedure

Step 1 – Download and populate the Planning and Preparation Workbook for your target platform.

Step 2 – To generate the JSON spec using inputs from the Planning and Preparation Workbook run the following command:

.\createManagementDomainSpec.ps1 -Workbook E:\MyLab\pnpWorkbook.xlsx -Json E:\MyLab\sfo\sfo-managementDomain.json -defaultPassword VMw@re1! -nsxtPassword VMw@re1!VMw@re1!

The createManagementDomainSpec.ps1 script will open the supplied Planning and Preparation Workbook, read the ‘Workload Domain’ tab into a variable and then proceed to generate the JSON spec required by the VMware Cloud Builder Public API. Because no passwords are stored in the Workbook we also need to pass default passwords for NSX-T (-nsxtPassword switch) and all other components (-defaultPassword switch), these are passed as part of the command line input of the script.

Step 3 – Authenticate to the VMware Cloud Builder appliance by running the following command:

Connect-CloudBuilder sfo-cb01.sfo.rainpole.io admin VMw@re1!

Step 4 – Perform a validation of the JSON spec file and the target platform by running the following command:

$sddcValidation = Start-CloudBuilderSDDCValidation –json E:\MyLab\sfo\sfo-managementDomain.json

Using the Start-CloudBuilderSDDCValidation cmdlet, we trigger the validation process, here I’m capturing the output of the command into a variable to be used in the next step.

Step 5 – Poll the status of the validation task, by running the following command:

Do { $status = Get-CloudBuilderSDDCValidation -id $sddcValidation.id } While ($status.executionStatus -eq "IN_PROGRESS")

Here we are using the unique ID from the Start-CloudBuilderSDDCValidation cmdlet which we retrieve from the variable $sddcValidation.id which is then passed to the the Get-CloudBuilderSDDCValidation cmdlet. Then we are doing a Do / While loop where we are looking for an executionStatus of “IN_PROGRESS”, once the state changes from “IN_PROGRESS” we break from the loop.

Step 6 – Assuming the validation process completed without any issues, we can then start the actual deployment by running the following command:

$sddcDeployment = Start-CloudBuilderSDDC -json E:\MyLab\sfo\sfo-managementDomain.json

Using the Start-CloudBuilderSDDC cmdlet, we trigger the deployment process and again capture the output of the command into a variable which is used in the next step.

Step 7 – Poll the status of the deployment task, by running the following command:

Do { $status = Get-CloudBuilderSDDC -id $sddcDeployment.id } While ($status.status -eq "IN_PROGRESS")

Like before we are going to poll the status of the deployment, using the unique ID from the Start-CloudBuilderSDDC cmdlet which we retrieve from the variable $sddcDeployment.id and pass this time to the Get-CloudBuilderSDDC cmdlet. Again we are doing a Do / While loop where we are looking for an executionStatus of ‘IN_PROGRESS”, once the state changes from “IN_PROGRESS” we break from the loop.

That completes the process of deploying the Management Domain using VMware Cloud Builder without using the User Interface.

About the Author:
Gary Blake is a Staff II Solutions Architect at VMware, focusing on VMware Cloud Foundation and VMware Validated Designs and is a lead contributor for PowerVCF. You can find Gary blogging at https://my-cloudy-world.com/ or on social media @GaryJBlake.

This article has been re-posted with permission from the author, and was originally posted at https://my-cloudy-world.com/.

Filter Tags

  • Automation
  • VCF Operational Guidance
  • Cloud Foundation