We briefly covered compiling DSC configurations for use on a pull server in Chapter 2, DSC Architecture, and we will build on that introduction here. We are going to use the following example DSC configuration with our DSC pull server. It's not fancy and it doesn't do a whole lot, but it is great at showing how DSC pull servers do the work for us:
Configuration SetupTheSite { Import-DscResource -Module PSDesiredStateConfiguration Import-DscResource -Module xWebAdministration Node $AllNodes.Where({ $_.Roles -contains 'Target'}).NodeName { WindowsFeature IIS { Ensure = 'Present' Name = 'Web-Server' } <#..#> xWebsite NewWebsite { Ensure = 'Present' State = 'Started' Name = $Node.WebSiteName PhysicalPath = $Node.WebSiteFolder BindingInfo = MSFT_xWebBindingInformation{ Protocol = 'HTTP' Port = '80' } DependsOn = '[File]WebContent' } } }
It uses the xWebSite and xWebApplication DSC resources from the xWebAdministration module to install a simple website on our target node. This allows us to showcase the DSC pull server distributing the MOF to the target nodes and distributing the xWebAdministrion module to all the target nodes as well. For these reasons, the following example DSC configuration is cut for length, so download the example book code to see the entire thing.