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.
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 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
- 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
dscmodule. While the
dscmodule 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_litemodule 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
dscmodule — 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
dscmodule 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_litedeclaration, with only minor edits. The original
dscmodule 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
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
module into the type, it’s now configurable inside the declaration in
module, allowing you to pick and choose which ones to use.
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
- You want
pluginsyncto benefit from a reduced footprint.
- You don't mind managing the installation of PowerShell modules containing DSC resources on your nodes.
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_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
dscmodule 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 Puppet||Yes||No|
|Ability to add custom DSC resources||Yes — requires build steps||Yes|
|DSC resources available||Those bundled with the Puppet dsc module||Any compatible with Invoke-DscResource|
|Ability to independently deploy DSC resources||No||Yes|
|Ability to read class-based DSC resources||No||Yes|
|Similar syntax to DSC||No||Yes|
|pluginsync||Larger footprint||Reduced footprint|
|Ability to report in Puppet Enterprise||Yes||Yes|
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.
- Read the
- Read more about the supported
- Read the white paper Managing Windows with Puppet Enterprise
- Watch the recording of our recent webinar Introduction to Puppet Enterprise for your Windows Environment