20160430 DevOps series: Is DSC a good CM tool for provisioning Windows Server

System Blog

DevOps series: Is DSC a good CM tool for provisioning Windows Server

 

What DSC is?

Powershell DSC or Powershell desired state configuration.

It is a windows version of CM tool based on powershell. it is equivalent to puppet or salt on linux platform.

Here is an example of it to create new website in IIS server

configuration Sample_xWebsite_NewWebsite
{
    param
    (
        # Target nodes to apply the configuration
        [string[]] $NodeName = 'localhost'

    )

    # Import the module that defines custom resources
    Import-DscResource -Module xWebAdministration, PSDesiredStateConfiguration

    Node $NodeName
    {
        # Install the IIS role
        WindowsFeature IIS
        {
            Ensure          = 'Present'
            Name            = 'Web-Server'
        }

       

        # Stop the default website
        xWebsite DefaultSite
        {
            Ensure          = 'Present'
            Name            = 'Default Web Site'
            State           = 'Stopped'
            PhysicalPath    = 'C:\inetpub\wwwroot'
            DependsOn       = '[WindowsFeature]IIS'
        }

      
    }
}

We can see that it is very "similar" to puppet code, what you need to do is simply turn above code into MOF(management object format) , LCM (local configuration manager) will apply this configuration definition locally. This is equivalent to to run puppet apply locally, and of couse, you can setup a DSC pulling server which act as puppet master.


Come back to our question, is DSC a good CM tool for provisioning Windows servers?
I would say


If you used Puppet to provision Windows server already, then you better keep using it, plus you can take advantage from DSC (as it is powershell, and you can calling it by using exec command, so that you don't have to reinvent the wheel, or write square wheel yourself.)

If you don't use Puppet, and you are working in a pure windows house, then you could choose DSC, it is better than not using any sort of CM tools at all.(unless you still enjoy something like: shit, one IIS feature is install on dev, but forgotten in production!)

If you have a mixed environment with windows and linux, and you don't have any sort of CM tools at all, and you plan to go DevOps, then theoretically you can use DSC, as DSC can be used to provision linux, but as DSC is not very popular yet (actually, it's been out there for at least 2 years already), you might find it difficult to get a DSC guru from the market, and there isn't as much resource as Puppet or Chef has available on the internet, so if you got stuck, then you might have to spend much longer time to find yourself a solution somewhere.



 

Posted by: leaonow on: April 30, 2016

 

Your Name:

OneTime Password:



Pic of the day