| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project is intended to suggest a new structure for sharing DSC Configuration, taking most of the ideas from Michael Greene in the dscconfigurations repo.
The value we're looking to provide, is to do something similar to DSC Resource for System or Service Configurations.
We want to lower the bar of bootstrapping infrastructure with DSC, by re-using configurations of system or services people have built and shared.
Using Geoffrey Moore's value proposition model:
For People starting with Configuration Management
Who need to deploy systems or services quickly
Our configuration sharing guidelines is a re-usable build process for DSC configurations
That transforms Configuration into re-usable and composable DSC Composite Resources
The intent is to:
To achieve the intent, we should:
Before going further it's good to have an understanding of how the DSC resource and configurations works, and the different method of composition they offers.
Below are ideas I think worth discussing and suggestions of implementation. Please raise issues to discuss them.
C:\SRC\SHAREDDSCCONFIG
│ .build.ps1
│ .gitignore
│ .kitchen.yml
│ appveyor.yml
│ Dependencies.psd1
│ LICENSE
│ README.md
│
├───.build
│ README.md
├───.kitchen
│ ├───logs
│ ├───OtherTestSuite-2012r2-WMF5
│ │ └───OtherTestSuite-2012r2-WMF5
│ │ ├───Snapshots
│ │ └───Virtual Machines
│ └───SharedDscConfig-2012r2-WMF5
│ └───SharedDscConfig-2012r2-WMF5
│ ├───Snapshots
│ └───Virtual Machines
├───docs
├───DscBuildOutput
│ └───modules [pulled according to Dependencies.psd1, modules not in git]
│ ├───BuildHelpers
│ ├───Datum
│ ├───DscBuildHelpers
│ ├───InvokeBuild
│ ├───Pester
│ ├───platyPS
│ ├───PSDeploy
│ └───PSScriptAnalyzer
└───SharedDscConfig
├───DscResources
│ └───Shared1
│ ├───ConfigData
│ │ └───common
│ └───Diagnostics
│ ├───Comprehensive
│ └───Simple
└───examples
├───ConfigData
│ └───AllNodes
└───DscBuildOutput
The Shared Configuration should be self contained, but will require files for building/testing or development. The repository will hence need some project files on top of the files required for functionality.
Adopting the 2 layers structure like so:
+-- ConfigurationName\
+-- ConfigurationName\
Allows to place Project files like build, CI configs and so on at the top level, and everything under the second level are the files that need to be shared and will be uploaded to the PSGallery.
Within that second layer, the Configuration looks like a standard module with some specificities.
This is tricky to get right.
The configuration data, IMO, should be managed in an 'override-only' way to preserve the cattle vs pet case. That is:
This cannot be done out of the box (without tooling), but it's possible using custom scripts or module, as I intend to with my Datum module.
The challenge is then to manage the config data for a shared config in a way compatible with using a Configuration Data management module or function.
I see two possible approach:
The second one is more flexible (anyone can create their custom one), but probably needs some time and a lot of communication before taking precedence over the static way.
We could provide a standard, simple function to resolve the static properties when creating Shareable configurations, where the logic can be overriden where consuming that shared configuration.
function Resolve-DscConfigurationData {
Param(
[hashtable]$Node,
[string]$PropertyPath,
[AllowNull()]
$Default
)
$paths = $PropertyPath -split '\\'
$CurrentValue = $Node
foreach ($path in $Paths) {
$CurrentValue = $CurrentValue.($path)
}
if ($null -eq $CurrentValue -and !$PSBoundParameters.ContainsKey('Default')) {
Throw 'Property returned $null but no default specified.'
}
elseif ($CurrentValue) {
Write-Output $CurrentValue
}
else {
Write-Output $Default
}
}
Set-Alias -Name ConfigData -value Resolve-DscConfigurationData
Set-Alias -Name DscProperty -value Resolve-DscConfigurationDataThis Allows to resolve static data so that:
DscProperty -Node @{
NodeName='localhost';
a=@{
b=122
}
} -PropertyPath 'a\b'Resolves to 122, but another implementation of Resolve-DscConfigurationData could do a database lookup in the company's CMDB for instance.
Doing so would allow to have functions to lookup for Configuration Data from the Shared Configuration, or from custom overrides.
The root of the tree would be similar to a module root tree where you have supporting files for, say, the CI/CD integration.
In this example, I'm illustrating the idea with:
Very similar to a PowerShell Module folder, the Shared configuration re-use the same principles and techniques.
The re-usable configuration itself is declared in the ps1, the metadata and dependencies in the psd1 to leverage all the goodies of module management, then we have some assets ordered in folders:
| Back | FazBrowse Home | New Git URL |