helindbe
10/26/2022, 10:06 AM$config_file = $config_file_override ? {
String[1] => £config_file_override,
default. => undef
}helindbe
10/26/2022, 10:07 AM$config_file = $config_file_override ? {
String[1] => $config_file_override,
default. => undef
}Philippe Beaumont
10/26/2022, 10:08 AMcruelsmith
10/26/2022, 10:09 AMcruelsmith
10/26/2022, 10:19 AMhelindbe
10/26/2022, 10:21 AM$config_file = $config_file_override ? {
Stdlib::Absolutepath => $config_file_override,
String => fail("config_file_override '${config_file_override}' is not a valid path")
default. => undef
}Slackbot
10/26/2022, 11:02 AMma_garvo
10/26/2022, 11:04 AMwindowsfeature { 'AD-Domain-Services':
ensure => present,
installmanagementtools => true,
}
dsc_addomain { 'create_primary_dc':
dsc_domainname => 'example.local',
dsc_credential => {
'user' => 'example.local\administrator',
'password' => Sensitive('ExampleP@ssW0rd!'),
},
dsc_safemodeadministratorpassword => {
'user' => 'administrator',
'password' => Sensitive('ExampleP@ssW0rd!'),
},
}
PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
[mNotice: Compiled catalog for oitmgndc02-uk in environment production in 0.29 seconds[0m
puppet : [1;31mError: dsc_addomain: PowerShell DSC resource MSFT_ADDomain failed to execute Get-TargetResource functionality with error message: System.Exception:
Please ensure that the PowerShell module 'ADDSDeployment' is installed. (DRC0009) [0m
At line:1 char:1
+ puppet apply .\test\install.pp --modulepath .\modules\ --verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ([1;31mError: d... (DRC0009) [0m:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
[0;32mInfo: Using environment 'production'[0m
[0;32mInfo: Applying configuration version '1666779036'[0m
[mNotice: /Stage[main]/Main/Windowsfeature[AD-Domain-Services]/ensure: created[0m
[mNotice: Applied catalog in 59.23 seconds[0m
Each subsequent run completes without applying anything:
PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
[mNotice: Compiled catalog for oitmgndc02-uk in environment production in 0.28 seconds[0m
[0;32mInfo: Using environment 'production'[0m
[0;32mInfo: Applying configuration version '1666781923'[0m
[mNotice: Applied catalog in 0.80 seconds[0m
PS C:\Users\Administrator\Documents> puppet module list --modulepath .\modules\
C:/Users/Administrator/Documents/modules
â"œâ"€â"€ dsc-activedirectorydsc ([0;36mv6.2.0-0-0[0m)
â"œâ"€â"€ puppet-windowsfeature ([0;36mv4.0.0[0m)
â""â"€â"€ puppetlabs-pwshlib ([0;36mv0.10.2[0m)ma_garvo
10/26/2022, 11:04 AMwindowsfeature { 'AD-Domain-Services':
ensure => present,
installmanagementtools => true,
}
dsc_addomain { 'create_primary_dc':
dsc_domainname => 'example.local',
dsc_credential => {
'user' => 'example.local\administrator',
'password' => Sensitive('ExampleP@ssW0rd!'),
},
dsc_safemodeadministratorpassword => {
'user' => 'administrator',
'password' => Sensitive('ExampleP@ssW0rd!'),
},
}
PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
[mNotice: Compiled catalog for testmgndc02-uk in environment production in 0.29 seconds[0m
puppet : [1;31mError: dsc_addomain: PowerShell DSC resource MSFT_ADDomain failed to execute Get-TargetResource functionality with error message: System.Exception:
Please ensure that the PowerShell module 'ADDSDeployment' is installed. (DRC0009) [0m
At line:1 char:1
+ puppet apply .\test\install.pp --modulepath .\modules\ --verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ([1;31mError: d... (DRC0009) [0m:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
[0;32mInfo: Using environment 'production'[0m
[0;32mInfo: Applying configuration version '1666779036'[0m
[mNotice: /Stage[main]/Main/Windowsfeature[AD-Domain-Services]/ensure: created[0m
[mNotice: Applied catalog in 59.23 seconds[0m
Each subsequent run completes without applying anything:
PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
[mNotice: Compiled catalog for testmgndc02-uk in environment production in 0.28 seconds[0m
[0;32mInfo: Using environment 'production'[0m
[0;32mInfo: Applying configuration version '1666781923'[0m
[mNotice: Applied catalog in 0.80 seconds[0m
PS C:\Users\Administrator\Documents> puppet module list --modulepath .\modules\
C:/Users/Administrator/Documents/modules
â"œâ"€â"€ dsc-activedirectorydsc ([0;36mv6.2.0-0-0[0m)
â"œâ"€â"€ puppet-windowsfeature ([0;36mv4.0.0[0m)
â""â"€â"€ puppetlabs-pwshlib ([0;36mv0.10.2[0m)Slackbot
10/26/2022, 11:16 AMsameer
10/26/2022, 11:17 AMBrian Schonecker
10/26/2022, 12:16 PMBrian Schonecker
10/26/2022, 12:16 PMBrian Schonecker
10/26/2022, 12:18 PMBrian Schonecker
10/26/2022, 12:20 PMSlackbot
10/26/2022, 12:51 PMSlackbot
10/26/2022, 1:29 PMSlackbot
10/26/2022, 2:03 PMSlackbot
10/26/2022, 6:25 PMSlackbot
10/26/2022, 7:16 PMsameer
10/26/2022, 7:27 PMsameer
10/26/2022, 7:27 PMAllahshukur Ahmadzada
10/26/2022, 8:25 PMWilliam Myers
10/26/2022, 10:44 PMnatemccurdy
10/26/2022, 10:50 PMnode definition in code or via an External Node Classifier (ENC).
At a lower level, and to make it convenient to do what you want, people follow the Roles and Profiles method where each node has a class from the role module applied to it via the classification process.
And if there’s a common set of modules/classes/code you want to apply to a set of roles, you’d put all that into a profile class and include that profile in each role as needed.William Myers
10/26/2022, 10:50 PMWilliam Myers
10/26/2022, 10:51 PMnatemccurdy
10/26/2022, 10:54 PMclass profile::base {
case $facts['os']['family'] {
'RedHat', 'Debian' : { include profile::base::linux }
'Windows': { include profile::base::windows }
default: { }
}
}
And to declare the profile::base class on all nodes, you could either explicitly add include profile::base to reach role class, or put include profile::base outside of a node definition or within the default node definition in site.ppnatemccurdy
10/26/2022, 10:55 PMprofile::base::linux that handles sshd config, service accoutns, etc…Greg Bristol
10/26/2022, 10:56 PM