From e371a7f01224b474aa8e43e556a9ff44320850e4 Mon Sep 17 00:00:00 2001 From: Michael Greene Date: Thu, 22 Feb 2018 07:21:56 -0600 Subject: [PATCH] reformat to include configdata in configuration script --- .../WindowsDNSServerWithZones.ConfigData.psd1 | 39 ------------------- WindowsDNSServerConfig.ps1 | 38 ++++++++++++++++-- 2 files changed, 34 insertions(+), 43 deletions(-) delete mode 100644 ConfigurationData/WindowsDNSServerWithZones.ConfigData.psd1 diff --git a/ConfigurationData/WindowsDNSServerWithZones.ConfigData.psd1 b/ConfigurationData/WindowsDNSServerWithZones.ConfigData.psd1 deleted file mode 100644 index ec3ef8e..0000000 --- a/ConfigurationData/WindowsDNSServerWithZones.ConfigData.psd1 +++ /dev/null @@ -1,39 +0,0 @@ -@{ - AllNodes = @( - @{ - NodeName = 'localhost'; - Role = 'DNSServer'; - ZoneData = - @{ - PrimaryZone = 'Contoso.com'; - ARecords = - @{ - 'ARecord1' = '10.0.0.25'; - 'ARecord2' = '10.0.0.26'; - 'ARecord3' = '10.0.0.27' - }; - CNameRecords = - @{ - 'www' = 'ARecord1'; - 'wwwtest' = 'ARecord2'; - 'wwwqa' = 'ARecord3' - }; - }, - @{ - PrimaryZone = 'Fabrikam.com'; - ARecords = - @{ - 'ARecord1' = '10.0.0.35'; - 'ARecord2' = '10.0.0.36'; - 'ARecord3' = '10.0.0.37' - }; - CNameRecords = - @{ - 'www' = 'ARecord1'; - 'wwwtest' = 'ARecord2'; - 'wwwqa' = 'ARecord3' - }; - }; - } - ) -} diff --git a/WindowsDNSServerConfig.ps1 b/WindowsDNSServerConfig.ps1 index 68ddd30..fc86714 100644 --- a/WindowsDNSServerConfig.ps1 +++ b/WindowsDNSServerConfig.ps1 @@ -32,7 +32,7 @@ https://github.com/Microsoft/WindowsDNSServerConfig/blob/master/README.md##relea #> -#Requires -Module xDNSServer +#Requires -Module @{moduleversion = '1.9.0.0'; modulename = 'xDNSServer'} <# @@ -57,16 +57,46 @@ configuration WindowsDNSServerConfig Import-DscResource -module 'xDnsServer','PSDesiredStateConfiguration' - Node $AllNodes.NodeName + $ZoneData = + @{ + PrimaryZone = 'Contoso.com'; + ARecords = + @{ + 'ARecord1' = '10.0.0.25'; + 'ARecord2' = '10.0.0.26'; + 'ARecord3' = '10.0.0.27' + }; + CNameRecords = + @{ + 'www' = 'ARecord1'; + 'wwwtest' = 'ARecord2'; + 'wwwqa' = 'ARecord3' + } + }, + @{ + PrimaryZone = 'Fabrikam.com'; + ARecords = + @{ + 'ARecord1' = '10.0.0.35'; + 'ARecord2' = '10.0.0.36'; + 'ARecord3' = '10.0.0.37' + }; + CNameRecords = + @{ + 'www' = 'ARecord1'; + 'wwwtest' = 'ARecord2'; + 'wwwqa' = 'ARecord3' + } + } + { - # WindowsOptionalFeature is compatible with the Nano Server installation option WindowsOptionalFeature DNS { Ensure = 'Enable' Name = 'DNS-Server-Full-Role' } - foreach ($Zone in $Node.ZoneData) + foreach ($Zone in $ZoneData) { xDnsServerPrimaryZone $Zone.PrimaryZone {