The Desired State Configuration (DSC) Resources for VMware was released late last year. This initial release was able to leverage the PowerShell DSC engine in order to declare configurations for a handful of ESXi host settings and a couple vCenter server settings. The response to these resources has been amazing! So amazing that over the last 7 months, there have been 64 issues and 74 pull requests. A result of all of that feedback, input, and code contributions brings us to the next release, version 2.0 of the DSC Resources for VMware!
The DSC Resources for VMware version 2.0 contains a number of new resources, lots of improvements, and a new way to access them. First and foremost, as requested, these resources are now available on the PowerShell Gallery! There are also a number of examples which have been added to the repository since the first release. In the root of the repo, there’s an ‘Examples’ folder which contains some examples of combining multiple resources into a single configuration. Then, within the resource itself, there’s a folder by the name of ‘Configurations’. This folder has example configurations of using these resources with configuration management utilities like Ansible, Chef, and Puppet. Lastly, there are 14 new resources for us to use!
Let’s walk through some of the new resources.
New Resources
These newly added resources can be easily categorized into the following buckets: Inventory, vSphere Standard Switch (vSS), and VMHost.
The new Inventory resources, which allow us to manage the existence of these object types, are:
- Cluster
- HACluster
- DRSCluster
- DatacenterFolder
- Datacenter
- Folder
The following is an example of using the Folder resource to manage a VM based folder, named Management, along with a folder nested in the first folder:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
Folder "Folder_Management" { Server = $Server Credential = $Credential Name = Management Location = '' DatacenterName = 'DemoLab' DatacenterLocation = '' Ensure = 'Present' FolderType = 'VM' DependsOn = "[Datacenter]DemoLab" } Folder Folder_Management_VMware { Server = $Server Credential = $Credential Name = 'VMware' Location = 'Management' DatacenterName = 'DemoLab' DatacenterLocation = '' Ensure = 'Present' FolderType = 'VM' DependsOn = "[Folder]Folder_Management" } |
The new vSS resources, which allow us to manage a VMHost’s vSS configuration, are:
- VMHostVss
- VMHostVssBridge
- VMHostVssSecurity
- VMHostVssShaping
- VMHostVssTeaming
The following is an example of using the VMHostVss resource to manage a vSS on a particular VMHost:
1 2 3 4 5 6 7 8 |
VMHostVss "esx01_vSS" { Name = $vmHost Server = $Server Credential = $Credential Ensure = 'Present' VssName = 'vSS_DSC' Mtu = 1500 } |
The new VMHost resources, which have been added to the already existing set of resources that manage VMHosts, are:
- VMHostService
- VMHostSettings
- VMHostSyslog
- VMHostAccount
The following is an example of using the VMHostService resource to manage an ESXi host’s SSH service to ensure it is running and the policy is set to automatic:
1 2 3 4 5 6 7 8 |
VMHostService "esx01_ssh" { Name = $Name Server = $Server Credential = $Credential Key = 'TSM-SSH' Policy = 'Automatic' Running = $true } |
Here’s a demo which combines a number of the new resources for the following configuration:
Datacenter: DemoLab
Folder Structures:
Development
- Linux
- Windows
Management
- Linux
- Windows
- VMware
Production
- Linux
- Windows
Summary
The DSC Resources for VMware have only been available for a short period of time, however they have made a tremendous impact! Over the last 7 months, there have been 64 issues and 74 pull requests to the GitHub repository. Today, we’re taking the culmination of that input and releasing the 2.0 version of these resources. This adds an additional 14 resources, a number of functionality improvements, and they have been added to the PowerShell Gallery!
I also want to say a special thank you to some of our community contributors: Luc Dekens, for his immense contributions to this release including having a hand in at least 8 of the new resources as well as Brett Johnson and Markus Fischbacher for their contributions as well!
To get started, it is now as simple to install as:
1 |
Find-Module -Name VMware.vSphereDSC | Install-Module |
For more information on this release, see the latest release page on the DSC Resources for VMware GitHub page.
Let us know in the comments how you’re using these in your environment and what resources you’re looking for next!