When utilizing Puppet's automatic parameter lookup in Hiera, what is the better pattern: keep all parameters in init.pp and refer to them in subclasses (similarly to the old params.pp scheme), or skip the parameters in init.pp and use subclasses to set them?
Pattern 1: all parameters in init.pp, e.g.
class myapplication (
$ssl_enable,
$ssl_cert,
$ssl_key,
$ssh_access_enable,
$ssh_access_key
...
) {
contain myapplication::ssh
contain myapplication::ssl
}
class myapplication::ssl (
$enable = $::myapplication::ssl_enable,
...
) { ... }
Pattern 2: parameters in subclasses, e.g.
class myapplication {
contain myapplication::ssh
contain myapplication::ssl
}
class myapplication::ssl (
$enable,
$cert,
$key
) { ... }
With APL and Hiera, the latter seems cleaner and more sensible -- it's easier to figure out where to set the parameter, IMO -- but the obvious downside is that parameters aren't all in one place, so it's theoretically harder to find them. I haven't been able to find any opinions on the matter.
(I'm not using the params.pp model because the modules I'm making are for one OS only, and the only real application of params.pp that I can see, now that we have APL, is dealing with OS variants.)
↧