homeblogintroducing dsclite new dsc module puppet

Introducing dsc_lite, a new DSC module for Puppet

Editor’s note: The content in this post has been updated to reflect syntax changes made in the 0.5.0 release on 10 July 2018.

We are pleased to introduce the Puppet dsc_lite module, a new approach for declaring Desired State Configuration (DSC) syntax in Puppet manifests — an alternative to our original Puppet dsc module.

Depending on what you want to achieve, one module might be better suited to you than the other. Below we share some ideas to help you decide which approach is best for you.

Why try the new dsc_lite module

The dsc_lite module is a lighter weight version of the Puppet dsc module, providing more flexibility for advanced users. It allows you to manage target nodes using DSC resources by using a generalized Puppet call.

The main benefits of dsc_lite include:

  • It has the ability to use Managed Object Format (MOF)-based or your own custom DSC resources without our compilation steps — a huge benefit over the original dsc module. While the dsc module could use any of these DSC resources, it required you to run a rake build task to build the Puppet types. Due to the many varied places to get DSC resources, this parsing was prone to errors. The dsc_lite module does not require any build steps.
  • It allows you to use any DSC resources that are compatible with Invoke-DscResource, rather than only being able to use those bundled with the Puppet dsc module — allowing you to use those class-based DSC resources as well as MOF-based DSC resources.
  • It has the ability to independently deploy these DSC resources. This allows you to use whatever mechanism you want to deploy these, with whatever version you need, without waiting for our release cadence.
  • It has the ability to use class-based DSC resources. The original dsc module parsed the MOF schemas to build the Puppet types, but could not read class-based DSC Resources.
  • It has syntax similar to DSC reduces type ceremony, which reduces cognitive load when translating DSC syntax to Puppet syntax. This allows you to copy and paste the DSC declaration into a dsc_lite declaration, with only minor edits. The original dsc module would have required you to edit each DSC resource parameter declaration.

To showcase this, let’s look at a DSC resource declaration:

This is a normal declaration that sets the content of a file using the File DSC Resource. If we were using the original dsc module, we would modify it like this:

Notice that we have to put dsc_ in front of the type, as well as in front of every parameter. It looks the same, but requires a bit of work to accomplish. Compare this with the syntax required in the new dsc_lite module:

With the new DSC_Lite module, we can copy paste the DSC resource parameter declaration into the properties block as it is — with the exception of changing the equals to have rockets. Instead of hardcoding the DSC resource name and module into the type, it’s now configurable inside the declaration in resource_name and module, allowing you to pick and choose which ones to use.

The dsc_lite module might well work better for you than the original dsc module, particularly if any of the following apply to you:

  • You need to use one or more DSC resources that are not vendored into Puppet's dsc module.
  • You want pluginsync to benefit from a reduced footprint.
  • You don't mind managing the installation of PowerShell modules containing DSC resources on your nodes.

Overall, dsc_lite is a module that has fewer safety checks than the dsc module, but provides more flexibility for the advanced DSC user.

Why you might want to consider sticking with the original dsc module

The dsc_lite module is in an early, unsupported state and undergoing rapid iteration. Switching to the new approach will require work to update the resource declarations in your manifests. In addition, with dsc_lite you're responsible for installing DSC resources onto all the nodes you want to configure with it.

We suggest sticking with the original dsc module if any of the following applies to you:

  • You have a good workflow for building an internal release of the Puppet dsc module with custom resources.
  • You want earlier feedback about the validity of manifest code.
  • You are using Microsoft-provided DSC resources, and not a custom, community-maintained, or class-based DSC resources.
  • You need the granularity of reporting in the Puppet Enterprise console which is based on each resource type being different, allowing you to filter and group on DSC resources.

This table summarizes the key benefits each of the DSC modules offers:

Supported by PuppetYesNo
Ability to add custom DSC resources Yes — requires build stepsYes
DSC resources availableThose bundled with the Puppet dsc moduleAny compatible with Invoke-DscResource
Ability to independently deploy DSC resourcesNoYes
Ability to read class-based DSC resourcesNoYes
Similar syntax to DSCNoYes
pluginsyncLarger footprintReduced footprint
Ability to report in Puppet EnterpriseYesYes
Early feedback YesNo

Whether you migrate to the new dsc_lite module, or choose to stick with the supported dsc module, we hope you find the right approach for your needs. Download the dsc_lite module and give it a try. As always, let us know what you think, on Slack or by filling a ticket in JIRA.

The Puppet Windows team is continually improving the experience for Windows sysadmins on the Forge. Check back for new releases and updates on our popular modules. Subscribe to modules to get notifications.

Claire Cadman is an associate technical writer at Puppet.

Learn more