Day 16: Connecting DevOps and ITIL (and DSC) Through the CMDB

Welcome to Day 16 of the “100 Days of DevOps with PowerShell”! For background on our goals in this series, see Announcing the “100 Days of Devops with PowerShell” Series here at SCC. If this is the first time you are viewing an article of the series and you are new to DevOps and PowerShell DSC, I encourage you to read through the previous installments, particularly Day 1.

In previous articles, I discussed the justification for using the enterprise configuration management database (CMDB) as the location for storing the DSC Configuration ID (guid) for nodes managed through DSC, as well as how to extend the Microsoft CMDB (hosted in System Center 2012 Service Manager) to store this value. Those articles are found here:

Today we are going to take the next step in connecting PowerShell DSC with our ITIL processes by learning how to extract the PowerShell DSC Configuration ID from our CMDB. In this example, we will continue using the System Center 2012 Service Manager (Service Manager or SCSM) CMDB, but with the understanding that we could replace SCSM and its CMDB with the service desk platform chosen by your organization.

Continuous deployment and highly standardized configuration require a strong commitment to process, so this is a critical consideration in the big picture. PowerShell DSC is a tool in our DevOps process, and so we want to integrate its use appropriately into our processes, such as change, release and configuration management.

Retrieving the DSC Configuration ID from the CMDB (SCSM, in this case)

In Day 5, we extended the Windows Computer class in Service Manager to include a new property, which we named DSCConfigID. If you follow the steps in the Day 5 article, you will see the property on your Windows Computer class in the Service Manager CMDB when you view Windows Computer configuration items (CIs) in your Service Manager Administrator Console.

image

When you extend a class in Service Manager, under the hood you are really creating a new, specialized class. We named that class PowerShell DSC Configuration ID. We will need that name when we attempt to retrieve the DSCConfigID for a computer from PowerShell.

image

Integrating DSC Automation with the CMDB

WIth the DSC Configuration ID in the CMDB, we need a bit of PowerShell to enable us to retrieve the ID as part of our automated processes, in this case to configure newly provisioned servers with their appropriate PowerShell DSC configuration. The snippet below will enable you to retrieve that value from a remotely.

NOTE: You will need to replace scsm1 with the name of your Service Manager management server and scorch1.contoso.com with a computer in your CMDB.

In this snippet, I’ve modified the sample above to create a simple function that accepts to the computer name (FQDN) as a parameter and retrieves its DSC Configuration ID from the Service Manager CMDB.

Call the function by name and provide the FQDN of the computer for which you wish to retrieve the DSC ID.

The output is the $guid variable populated with the value of DSCConfigID property of the specified computer.

image

Applying the Configuration

If we go back to Day 6, Scott demonstrated how to apply the configuration to a node when you have a DSC Pull Server that is configured for HTTPS (remove the S if using an HTTP Pull Server). This is the snippet you run on the managed node itself (as in Day 6), or from a central location using PowerShell Remoting.

Since we are retrieving the DSC Configuration ID and storing in the $guid variable, wouldn’t it be great if we could automate the application of the DSC local configuration to the managed node from a central location as well?

To be continued…

Conclusion and Next Steps

That’s all for this installment. While this is a good next step, it’s not yet a fully automated, end-to-end process to achieve our DevOps goals. I’ll continue this line of thought in future installments as we continue on our journey.

I hope you have found this article (and this series, in progress) helpful. Please post comments and errata in the comments below.

Previous Installments

To see the previous installments in this series, visit “100 Days of DevOps with PowerShell”.

2 thoughts on “Day 16: Connecting DevOps and ITIL (and DSC) Through the CMDB

  1. Wilson W.

    Excellent and timely article Pete. I’m in the process now of building out my company’s CMDB and adding a field to a server CI for DSC ID is definitely something that aligns with our company’s DevOps goals.

  2. Pete Zerger Post author

    Wilson, glad you find this line of discussion interesting. I’m trying to lay some groundwork here so we can stitch together the end-to-end process through the course of the next 85(ish) installments.

Leave a Reply

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