Reputation: 41
I want to manage the servers in our staging pipeline with Powershell DSC (push model). The servers map to the environments as following
The server(s) within one environment do have the same configuration. But the configuration is different between the environments. I wanted to go with the push model because I do not have to setup a pull server.
Powershell DSC offers the option to manage the configuration via configuration data in a separate file But this comes with the caveat that you need to specify a node name that matches the respective server name. And that means, I need to copy the configuration data for each server in one environment. And when changing the configuration I need to remember that there is a second place where I need to update the configuration value.
Additionally, I do not really care about the server names. If the servers are exchanged tomorrow for new servers, the configuration should be just applied which is relevant to the environment.
What is the best practice approach to manage multiple servers within one environment with the same configuration?
Upvotes: 3
Views: 1354
Reputation: 808
The mof file that gets produced does not contain the nodename inside it. So as long as you build a generic configuration, you can rename it after the fact at deploy time.
You can create one config for each environment with some generic name. Then enumerate the list of servers and make a copy of the config for each one with that servers name.
You can take it a step further. Have a share where you create a folder for each server that matches the server's name. Then copy the mof for that server into that folder with a name of localhost.mof
. You can then run Start-DSCConfiguration -Path \\server\share\$env:computername
from that machine as part of my deployment script.
Upvotes: 1
Reputation: 2848
Check the links, I think they cover scenerio
Using A Single DSC Configuration for Multiple Servers enter link description here
DSC ConfigurationNames with multiple nodes enter link description here
Upvotes: 1