Hello,
I've come across an issue with how I want to write profiles vs how a module chooses to structure their default data. As an example, the choria-io/puppet-mcollective module uses hashes of in-module data for each configuration file (which is quite elegant, reduces the amount of templates needed). My issue with it is how I want to explicitly define some parameters for a profile I'm writing. If I set a few keys of the 'server_config' hash I end up overwriting the rest of the defaults in the module data, because an explicitly defined class param trumps the entire in-module data hash:
**************************
class { '::mcollective':
server => true,
client => true,
server_config => {
rpcauditprovider => 'choria',
'plugin.rpcaudit.logfile' => '/var/log/puppetlabs/choria-audit.log',
},
}
**************************
I've got a solution by calling lookup() to get the original data structure, then doing a hash merge in Puppet code:
**************************
$default_data = lookup('mcollective::server_config')
$my_data = {
rpcauditprovider => 'choria',
'plugin.rpcaudit.logfile' => '/var/log/puppetlabs/choria-audit.log',
}
class { '::mcollective':
server => true,
client => true,
server_config => $default_data + $my_data,
}
**************************
Would anyone consider that a dumb approach? Are there better ways?
Thanks,
-Luke