Hi community
Hope someone can help me. I read a lot about nesting configurations, partial configurations, reusing configurations, modules, resources and so on.
But I cannot find a solution for my problem.
Ok, here we go. This is just one example, I have lots of identical problems with other modules and properties. This is a more a conceptual problem.
I’d like to configure several IIS websites for several customers for several different applications in several environments (hope you get it).
I use the xWebAdministration Module.
We have company standards on how a website has to be configured. E.g. we have defined, that every applicationpool must be recycled at 2 am. (restartSchedule = @(‘02:00:00’)).
(We have hundreds of such settings. And it’s not just IIS websites.)
So this setting will be part of the “CompanyIISWebsite” Composite Resource in the “CompanyDSCCompositeResource” Module (tried it this way for now).
Now, let’s say I have a faulty application which needs another recycle during the day.
So if I define this setting in the “application specific” part of my configuration, I get an error:
Composite Resource:
Configuration CompanyIISWebsite { param( [string]$WebSiteName, [string]$WebRoot ) Import-DscResource -ModuleName xWebAdministration xWebAppPool CreateWebAppPool { Name = $WebSiteName Ensure = "Present" State = "Started" restartSchedule = @('02:00:00') } #other configuration }
Application Configuration:
Configuration applicationA { #Import module with "CompanyIISWebsite" resource Import-DscResource -ModuleName CompanyDSCCompositeResource Node $AllNodes.NodeName { #Create website according to company standards CompanyIISWebsite applicationA { WebSiteName = $ConfigurationData.WebConfig.WebSiteName WebRoot = $ConfigurationData.WebConfig.WebRoot } #Additional settings for this application xWebAppPool AdditionalRestartSchedule { Name = $ConfigurationData.WebConfig.WebSiteName Ensure = "Present" State = "Started" restartSchedule = @('02:00:00','12:00:00') } } }
I understand that this configuration gives the following error, because of how LCM works:
PS C:\DSC\applicationA> .\applicationA.ps1 Test-ConflictingResources : A conflict was detected between resources .... Resources have identical key properties but there are differences in the following non-key properties: 'restartSchedule'. Values 'System.Object[]' don't match values 'System.Object[]'. Please update these property values so that they are identical in both cases.
From my expectations, the value should be overwritten (or added). If I cannot override properties, I can’t find a way to create a modular/hierarchic and reusable configuration.
One solution could be that I pass every possible value to the CompanyIISWebsite resource. But this would result in a lot of effort and a big overhead, because I don’t know which setting I’m going to use in the future.
Somehow no one else seems to have this kind of problem. Seems to me as nobody uses DSC in such an environment as I work.
Maybe DSC is not the right tool for our goal or I just cannot see the solution. Or I don’t fully understand the concept. We are somewhere in between Configuration Management and Application Deployment.
I also played with Ansible and this seems more my way to go with the task and role concept. But I’d really like to go the Microsoft way.
Any suggestions or links would be great. Thank you very much.
Regards
Jeans