DSC Part 2
In my previous article I talked about Desired State Configuration in a more or less generic way. I provided a sample Configuration that installed the basic services needed for a web server. This Configuration could be applied locally and once applied you could manage it manually as needed.
But the cool setup what is called a pull server (a push server can also be setup but is more complex ). A pull server is basically a web server that has been configured with the proper DSC services and setup to listen.
The main difference between something local and a pull server is the Configurations are required to use GUID’s instead of computer names. Additionally the MOF files get hashed and the hash is stored in a file named after the MOF. These two files are then uploaded to the pull server and your client (target node ) is configured to point at the pull server.
You can define intervals such that every 30 minutes the client will check in with the pull sever to validate it’s configuration. If something is missing, it will re-apply the configuration automatically.
So, if you already ran the Configuration from part 1, then you’re already halfway there. I’ll setup through the manual process for configuring the web portion of the pull server (keep in mind Microsoft has released some Configurations that will assist with this ). We’ll need to make sure that the DSC service is available.
The next thing we need to do is setup the web portion of the pull-server. This entails copying files, creating an Application Pool, and setting up a website.
This leaves a few manual steps left to do, adding a few lines to the web.config file and setting the newly created Application Pool’s identity to LocalSystem.
<add key="dbprovider" value="System.Data.OleDb" /> <add key="dbconnectionstr" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\WindowsPowerShell\DscService\Devices.mdb;" /> <add key="ConfigurationPath" value="C:\Program Files\WindowsPowerShell\DscService\Configuration" /> <add key="ModulePath" value="C:\Program Files\WindowsPowerShell\DscService\Modules" />
These lines are added inside the appSettings section of the web.config file. These are default values and can be left as is, they define where the modules are if you need any, and where the Configurations will be stored.
The last thing you need to do is open up IIS Manager, open Application Pools and find your Application Pool in the list. Click on it, and select Advanced Settings, click on Identity and then the build button, and from the list choose LocalSystem.
Once you’re done you should be able to point your browser at your server and see an xml output
<?xml version="1.0" encoding="utf-8" ?> <service xml:base="http://pullserver.company.com/PSDSCPullServer.svc/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> <workspace> <atom:title>Default</atom:title> <collection href="Action"> <atom:title>Action</atom:title> </collection> <collection href="Module"> <atom:title>Module</atom:title> </collection> </workspace> </service>