Desired State Configuration (DSC) – Experimenting with DSC Part 1 – Set up pull server

I’m having a go at DSC this week to try and streamline our build processes and see what all the fuss is about. I’ll be posting my findings as I progress.

My aim is to have one server that will hold the configurations, that can then act as the server that all of the other nodes pull from.

To set up a solution in which we are able to set up a server that holds the configurations, and then have target nodes pulling from this server, I will be performing the following tasks:

  1. Set up pull server (this part)
  2. Create the configuration file that is to be pulled by the target node
  3. Set target node to pull the configuration from the pull server

Step 1. Create your build server, eg. GTDSCAUP001

Step 2. Download the xPSDesiredStateConfiguration Module, currently found at http://gallery.technet.microsoft.com/xPSDesiredStateConfiguratio-417dc71d

Unzip the module to the %programfiles%\WindowsPowerShell\modules directory.

DSC_PullServer-1.png

Step 3. Add the Windows PowerShell Desired State Configuration feature via add roles and features. Add all other required features.

Step 4. Enable winRM if not already enabled.

winrm quickconfig

Step 5. Run the below script to create the configuration MOF file for the pull server.

*Only the last line needs changing if the server has a different name.

configuration NewPullServer

{
param
(
[string[]]$ComputerName = ‘localhost’
)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $ComputerName
{
WindowsFeature DSCServiceFeature
{
Ensure = “Present”
Name = “DSC-Service”
}
xDscWebService PSDSCPullServer
{
Ensure = “Present”
EndpointName = “PSDSCPullServer”
Port = 8080
PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer”
CertificateThumbPrint = “AllowUnencryptedTraffic”
ModulePath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules”
ConfigurationPath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration”
State = “Started”
DependsOn = “[WindowsFeature]DSCServiceFeature”
}
xDscWebService PSDSCComplianceServer
{
Ensure = “Present”
EndpointName = “PSDSCComplianceServer”
Port = 9080
PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer”
CertificateThumbPrint = “AllowUnencryptedTraffic”
State = “Started”
IsComplianceServer = $true
DependsOn = (“[WindowsFeature]DSCServiceFeature”,”[xDSCWebService]PSDSCPullServer”)
}
}
}
#This line actually calls the function above to create the MOF file.
NewPullServer –ComputerName GTDSCAUP001.domain.local

Step 6. Run the below script to apply the MOF file, which will tell it to be the pull server.

Start-DscConfiguration .\NewPullServer –Wait

To test that the server is ready you can browse to “http://localhost:8080/PSDSCPullServer.svc/”, which should display the below.

DSC_PullServer-2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s