28 Days of DSC: Day 2 Using Configuration Data1 min read

Hey Guys, two posts on consecutive days…amazing!

Following on from my post from yesterday, The Basics, I’m going to show you what ConfigurationData is all about.

During this month there will be some easy topics and some not so easy topics. ConfigurationData can be one of those more complicated topics if you aren’t used to working with data.

Please don’t be disheartened! We all start somewhere and there is a wealth of information and people out there to help you.

The basics are covered over on docs.microsoft.com, however I’m hoping to add a little real world experience to the mix.

Since the declaration of the configdata is well documented and fairly simply let’s jump straight into the tips.

1. Use the nodename * block to assign information to all subsequent nodes

If it needs to be overwritten, it can be done simply by defining the property again at the specific node.

2. Separate ConfigData blocks into separate files

Having separate files for say development, integration & production is a good way to start separating out your config data.

Splitting them up even further by departments or applications means the files are easier to read, since they’re smaller.

And an added benefit is when using version control systems such as git, you reduce the change of merge conflicts occuring.

3. Use Non-NodeData

Use Non-NodeData with the property roles to pickup data as necessary depending on the node role assignments

To get this data in the configuration script, use the following example. It may look complicated but basically, it’s comparing the list of roles in the SQLData object to see if they are all present/one is present on the node, if true return, if not move on.

4. Keep It Simple

This may seem in contrast to the last point, but when necessary, we can get clever and do cool things but at the end of the day we need to be able to read and understand what is going on. Over-engineering just means fewer people can support you and your configurations.

5. Seek help from the community

Hopefully you are already involved in the DSC community, but for those of you needing to maintain large configuration data sets, perhaps for 10s/100s/1000s of nodes with x applications. Consider using a solution already built and tested to help handle such complexity.

A lot of DSC engineers, have their own methods of generating ConfigData from SQL Databases and APIs etc.

I would recommend chceking out Gael Colas @gaelcolas, he created a project on GitHub called Datum which does similar things to that what I’ve already mentioned but with a few nice added features.

Firstly, its file based which means it can be easily versioned in something like git.

Also, it has features such as being able to set precedence in order to determine what the “Resultant Set” of properties are, think GPO.

The built-in lookup tool can be used to easily show how the configdata looks for any particular node; useful when someone quickly wants to know how the config looks for SQL01.

Putting it together

Here is a very simple SQL installation using configdata and the skills we’ve learned over the last 2 posts.

Phew! Another day, another DSC topic covered, only 26 more days until you are a master of the “desired state” arts.

I look forward to hearing from you either in the comments or on Twitter with the #DFTAI or #28DaysOfDSC, either because something is unclear or to tell me you’re enjoying the series.

Thanks & Don’t Forget To Automate It!

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.