Skip to content

Instantly share code, notes, and snippets.

@gaelcolas
Created February 7, 2018 01:43
Show Gist options
  • Save gaelcolas/7dd09c1584d875b09e3624203ce59548 to your computer and use it in GitHub Desktop.
Save gaelcolas/7dd09c1584d875b09e3624203ce59548 to your computer and use it in GitHub Desktop.
Configuration MyDscConfig {
# Import the module that has the 'ServerType' configuration
Import-DscResource -ModuleName Platform
# Import the module that has the 'Application' Configuration
Import-DscResource -ModuleName Product
$ConfigurationData.AllNodes.Nodename {
$ConfigurationData.Roles.($Node.Role).configurations.Foreach{
$ConfigurationName = $_
$ConfigurationParameters = $ConfigurationData.Roles.($Node.Role).($ConfigurationName)
# This weird notation is to avoid scoping issues when invoking the DSC Composite Resource
(Get-DscSplattedResource -ResourceName $ConfigurationName -ExecutionName "$($ConfigurationName)_inc" -Properties $ConfigurationParameters -NoInvoke).Invoke($ConfigurationParameters)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment