Skip to content

Instantly share code, notes, and snippets.

@bgelens
Last active August 29, 2015 14:18
Show Gist options
  • Save bgelens/572adaaed9cc32d1ebb5 to your computer and use it in GitHub Desktop.
Save bgelens/572adaaed9cc32d1ebb5 to your computer and use it in GitHub Desktop.
configuration SQL
{
Import-DscResource -ModuleName xSQLServer,xDisk
node sql01
{
xWaitForDisk SMAInstallDisk
{
DiskNumber = 2
RetryIntervalSec = 60
RetryCount = 60
SkipConsistencyIf = '[xSQLServerSetup]SQL'
}
xDisk Installdisk
{
DiskNumber = 2
DriveLetter = 'I'
DependsOn = '[xWaitForDisk]SMAInstallDisk'
SkipConsistencyIf = '[xSQLServerSetup]SQL'
}
xSQLServerSetup SQL
{
InstanceName = 'MyInstance'
SourcePath = "I:\"
SourceFolder = "SQL2014"
Features= "SQLENGINE,SSMS"
SecurityMode="SQL"
DependsOn = '[xDisk]Installdisk'
}
}
}
@bgelens
Copy link
Author

bgelens commented Apr 2, 2015

Scenario: DSC is not the only mechanism in play, external automation also interacts with the node (SMA / AA).
We want to temporarily add a disk with install sources to a VM during deployment. DSC is used to install SQL server.
We use the xWaitForDisk and xDisk resource to make sure the install disk is present before the installation of SQL will kick in.
When SQL is installed, we want to remove the disk with install sources from the node.

Problem: We have build a dependency on the install disk and if we remove the disk after installation is finished, the node is not consistent anymore but actually is in the desired state.

Current Resolve: We could create a new MOF file containing only the SQL installation configuration.

Suggestion: What if we would have another default configuration property like ’DependsOn’. But in this case we could inform the LCM to skip consistency check for a configuration if another configuration is already consistent.

I made a mockup of a possible additional property (SkipConsistencyIf). The idea is this: the LCM would see that it should first run the test method of the xSQLServerSetup configuration. If its test result is False, the LCM would know to carry on with the xWaitForDisk test method. If the result is True, the xWaitForDisk and xDisk test methods are skipped.

@nicholasdille
Copy link

The scenario is very valid and will probably come up in many complex environments. BTW, the example is nicely chosen because providing the installation media for role like SQL server is a PITA ;-)

Your proposal does get the job done with regard to initial installations but this configuration may fail to reach consistency in subsequent checks because the SQL Server resource may not be able to "make it so" again because of the missing installation media.

I "fear" that we need to ascertain the availability of installation media to enable the self healing powers of DSC ... well, as long as the resource was written to achieve this ;-)

Still, I am not about to dismiss you idea yet ;-) I have thought about alternatives that have always brought be back to SkipConsistencyIf. I guess we will come up with a scenario that requires it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment