I finally got some time to update my Automated VMware Cloud Foundation Lab (VCF) Deployment script to support the latest VCF 5.1 release as this has been requested by a number of folks both internally and externally.
In addition to updating some of the new resource requirements such as increasing the Nested ESXi vSAN capacity drive from 60GB to 100GB, I was also thinking about some of the feedback that I had received internally from one of our engineers and that gave me some ideas on how to further stream the deployment using automation. I also came up with a few new ideas that I have added to the script, some of which I will cover in a future blog post 😁
The first thing you will notice is that you can now specify the number of ESXi hosts to deploy both for the VCF Management Domain as well as for a Workload Domain.
The script is doing more than just deploying the required Nested ESXi VM, but it will actually generate the VCF commission host file (JSON) that can then be used make SDDC Manager aware of the new ESXi hosts, which can then be used to deploy a Workload Domain.
While the previous version of the script already generated the required VCF Management Domain bringup file (JSON) based on your input, the VCF Bringup was performed manually by logging into the Cloud Builder UI and uploading the generated JSON file to begin the deployment. I have now enhanced the script to automatically wait for the Cloud Builder VM to be ready and then automatically initiate the VCF Bringup using the generated JSON, so there are no additional manual steps required other than opening a browser to the Cloud Builder URL to monitor the progress of your VCF deployment!
In my environment, the deployment of the 8 x Nested ESXi VM, Cloud Builder VM and initiating the bringup process took ~19minutes and then it took another ~1.5hrs for the complete VCF Management Domain to be fully deployed and configured. YMMV based on your available resources
Hopefully folks apperciate the additional simplicity of using this script and if you have any feedback, feel free to drop a comment here or better yet, leave a comment directly in the repo or even submit a PR. For the complete list of changes in the script, be sure to check out the change log section of the README in the repo. Enjoy!
Niclas says
Fantastic William! Thanks for sharing!
Matt T says
Will this work for non-nested configurations - Like your previous script you used to deploy VCF on Intel NUCs? I have 3 SFF hosts with similar in specs to the NUCs and want to deploy VCF - one MGMT two workload hosts - but reading through this script it looks like its mainly for nested builds.
William Lam says
Please see README for requirements
*protected email* says
Hi,
love your work. Great article. Just been running against a standalone host - not working as expected - lots of errors on not finding values:
[07-01-2024_08:33:53] Connecting to Management vCenter Server 10.100.1.148 ...
Get-Cluster: C:\VCF\vcf-automated-lab-deployment.ps1:263
Line |
263 | $cluster = Get-Cluster -Server $viConnection -Name $VMCluster
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 01/07/2024 08:33:53 Get-Cluster Cluster with name 'Compute' was not found using the specified filter(s).
Get-OvfConfiguration: C:\VCF\vcf-automated-lab-deployment.ps1:272
Line |
272 | $ovfconfig = Get-OvfConfiguration $NestedESXiApplianceOVA
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 01/07/2024 08:33:53 Get-OvfConfiguration This cmdlet requires a vCenter Server connection.
InvalidOperation: C:\VCF\vcf-automated-lab-deployment.ps1:273
Line |
273 | $networkMapLabel = ($ovfconfig.ToHashTable().keys | where {$_ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
InvalidOperation: C:\VCF\vcf-automated-lab-deployment.ps1:274
Line |
274 | $ovfconfig.NetworkMapping.$networkMapLabel.value = $VMNetwork
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'value' cannot be found on this object. Verify that the property exists and can be set.
William Lam says
Please see requirements 🙂 Hint: vCenter is required
*protected email* says
Ah - readme - not for standalone host....
mauro balbiani says
Hi William
the requrements mention a Standard or Distributed Portgroup (routable) to deploy all VMs. Why routable? Is it a must?
William Lam says
That was to convey that from the system where you run the PowerCLI script, that it'll be able to communicate to the network where the VMs are deployed and that it isn't some isolated network that you can't reach
Afzal Hossain says
[10-20-2024_03:39:11] Logging into SDDC Manager ...
[10-20-2024_03:39:11] Retreiving VCF Management Domain vcf-m01-rp01 PoolId ...
[10-20-2024_03:39:11] Updating vcf-commission-host-api.json with PoolId value ...
[10-20-2024_03:39:11] Validating ESXi host commission file vcf-commission-host-api.json ...
[10-20-2024_03:40:05] Comissioning new ESXi hosts for Workload Domain deployment using vcf-commission-host-api.json ...
[10-20-2024_03:40:05] Host commission has not completed, sleeping for 30 seconds
[10-20-2024_03:40:35] Host commission has not completed, sleeping for 30 seconds
[10-20-2024_03:41:06] Host commission has not completed, sleeping for 30 seconds
[10-20-2024_03:41:36] Retreiving unassigned ESXi hosts from SDDC Manager and creating Workload Domain JSON deployment file wld-w01.json
Cannot find an overload for "add" and the argument count: "2".
At E:\wld\vcf-automated-workload-domain-deployment.ps1:340 char:9
+ $payload.computeSpec.clusterSpecs.Add("clusterImageId",$clust ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
[10-20-2024_03:41:36] Starting Workload Domain deployment using file wld-w01.json
New-VCFWorkloadDomain : The validation task commpleted the run with the following problems:
At E:\wld\vcf-automated-workload-domain-deployment.ps1:348 char:22
+ ... eployment = New-VCFWorkloadDomain -json $VCFWorkloadDomainDeploymentJ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-VCFWorkloadDomain
Script File: C:\Program Files\WindowsPowerShell\Modules\PowerVCF\2.4.1.1000\PowerVCF.psm1 Line: 1951
Relevant Command: Write-Error $response.validationChecks.errorResponse.message
Target Uri:
Exception Message: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Message'. Specified method is not supported.
Error Message:
[10-20-2024_03:41:47] Open a browser to your SDDC Manager to monitor the deployment progress
[10-20-2024_03:41:47] VCF Workload Domain Deployment Complete!
[10-20-2024_03:41:47] StartTime: 10/20/2024 15:39:05
[10-20-2024_03:41:47] EndTime: 10/20/2024 15:41:47
[10-20-2024_03:41:47] Duration: 2.69 minutes to initiate Workload Domain deployment
PS E:\wld>
SamusArun says
I ran into this same error. I'm not sure why I was getting the cluster count error. But the 2nd part that error'd on the "New-VCFWorkloadDomain" function was failing due to bad licensing. Once I fixed my licenses, that succeeded and kicked off. However, again.... i'm not sure why I continue to get the cluster count issue.