Simplicity is something I try to strive for when creating automation, whether that is for myself or for our customers. When I develop a script, I try to keep everything within a single file, so that it is easy to share and consume. As a script increases in functionality, it may be useful to break out some of its functions, typically libraries or modules.
I was recently debugging an issue with my popular automated lab deployment script for VMware Cloud Foundation (VCF) and while looking through the script that the user had been using, I found numerous variables that were commented out and replaced with their own values, which looked like they had different configuration and environments where they were using this single script.
It then hit me, why have I not considered externalizing all the variables that the script relied on, such that a user could easily supply different configuration options without needing to edit the primary deployment script!? 😅
This was clearly the solution that I should have been considered once the script grew in popularity but due to my goal of keeping the script "simple", I had not thought about this until I saw someone else version of the script ... which is funny as I have also found myself making copies of the script for use in different infrastructure environments 🤣
The VCF Automated Lab Deployment Script now accepts new -EnvConfigFile parameter which simply points to ps1 file that contains all the variables used by the deployment script. The script continues to function as previously, but rather than editing the script every time there is an environment or BOM change, you can simply create or edit this external configuration file.
Here is a screenshot of what that now looks like for deploying VCF Management Domain:
In addition, the supplemental VCF Workload Domain script has also been enhanced to support the same -EnvConfigFile parameter which you can see in the screenshot below:
I have also tested this with the latest VCF 5.2.1.1 release and have also resolved vLCM based issue that had been reported earlier.
I have also updated my other popular vSphere 8.x Automated Lab Deployment Script to also accept the new -EnvConfigFile parameter which simply points to ps1 file that contains all the variables used by the deployment script. You can refer to the Github repo for updated change and example variable file.
I'd love to squeeze this onto a HP Z440 workstation with 256GB of ram.. what corners can be cut to support that install scenario?