I’m looking for some tips on organizing dsc configurations.
Instead of writting one giant configuration I would like to break them into smaller-individual scripts.
Such as writting individual configurations like:
`
Configuration WebServer {}
Configuration WindowsFeatures {}
Configuration Applications {}
`
My typical configuration is broken into 3 files:
The configuration:
`
Configuration SetupInstall
{
param (…)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $AllNodes.where{ $_.Role.Contains("Production") }.NodeName
{
# Resources added here...
}
}
SetupInstall -ConfigurationData “configData.psd1” -PackagePath “\…”
`
the config data:
`
@{
AllNodes = @(
@{
NodeName=“*”
}
@{
NodeName = “Example”
Role = “Production”
TempFolder = “c:\dsc”
}
);
}
`
The command to manually run the configuration until we use a pull server:
`
Start-DscConfiguration -Path .\SetupInstall -Verbose -Wait -Force
`
I would like to break the configurations into multiple files and still run one command to start the configuration.
If this is not clear imagine a scripting language like PHP:
// FileName: Config.php
include(‘web-config.php’);
include(‘app-config.php’);
include(‘db-config.php’);