----- Original Message ----- > From: "Wolf Noble" <wno...@datapipe.com> > To: "<puppet-users@googlegroups.com>" <puppet-users@googlegroups.com> > Sent: Friday, December 7, 2012 8:08:40 PM > Subject: [Puppet Users] Poll for thoughts on hierifying modules and OS > default differences > > Hello lovelies, > > Our team is deliberating a few different options for the > hierification of our modules; and wanted to poll the collective > genius before making our decision. > > As we all know, there are certain attributes of a package which are, > by default, consistent on an OS... say, the name of a package..... > > class foobar { > include foobar::params > $package = $foobar::params::package > Package {$package: > ensure => installed > } > } > > class foobar::params { > case $osfamily: > redhat: { > $package = 'foobar' > } > debian: { > $package = 'foobard' > } > default: { > fail > } > } > > > well, we want to be able to overide those defaults with hiera: > > class foobar { > include foobar::params > $package = $foobar::params::package > Package {$package: > ensure => installed > } > } > > class foobar::params { > case $osfamily: > redhat: { > $package = hiera('foobar_package','foobar') > } > debian: { > $package = hiera('foobar_package','foobard') > } > default: { > fail > } > } > > > which is great, except now the package name is wrong by default on > debian boxes... > > now sure, I can argue that my hierarchy should have places to > logically separate out and override those 'inconvenient' defaults, > ie for an environment that uses debian... > > one of our engineers suggested the following paradigm: > > > class foobar { > include foobar::params > $package = $foobar::params::package > Package {$package: > ensure => installed > } > } > > class foobar::params { > case $osfamily: > redhat: { > $package = hiera('foobar_os_rhel_package','foobar') > } > debian: { > $package = hiera('foobar_os_deb_package','foobard') > } > default: { > fail > } > } > > which makes our topmost hierarchy (which is not segregated by OS, > because the relevant hierarchies doen't split very cleanly at the OS > level.) a little more bloated: > > foobar_os_deb_package: 'foobard' > foobar_os_rhel_package: 'foobar' > > > but makes for less overriding and additions for "default" setups... > > > to be honest, I'm not sure which idea (or what other as yet unthought > of idea) has the most merit, and I'd love to hear your thoughts on > the matter before we get too much further
hiera() takes 3 arguments, the last is a temporary hierarchy pre-pend. hiera("foobar_pkg", "foobar", $::osfamily) if your hierarchy was ["your.box.com", "common"] then for this single hiera lookup it would become: ["RedHat", "your.box.com", "common"]. It's not perfect but worth considering. Additionally we're seeking feedback on a possible approach towards dealing with this problem in the issue http://projects.puppetlabs.com/issues/16856 it would be good to know if this might sort you out -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.