Created
June 11, 2012 15:43
-
-
Save jedi4ever/2910754 to your computer and use it in GitHub Desktop.
hiera defines musings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define mymodule::party( $param1 , $param2 | |
) { | |
} | |
With Hiera I can do | |
define mymodule::party( $param1 = hiera('param1','somedefault1') , $param2 = hiera('param2','somedefault2') | |
) { | |
} | |
But I'd like to have the default come from my data.pp/params.pp file per module | |
Would the hiera backend :puppet take care of this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define logstash::agent( | |
$osUser = undef , | |
$version = undef , | |
$installDir = undef , | |
$downloadUrl = undef , | |
$javaHome = undef , | |
$javaMx = undef , | |
$config = undef | |
) { | |
# Load defaults from params (and possibly hiera) | |
include logstash::data | |
# some day we'll replace it with | |
# defaultify('real_','data',['osUser','version','...']) | |
# Alternative1: use data.pp with puppet data in hiera - makes the module dependent on hiera config | |
# Alternative2: use $osUser = hiera(... in vars, means we can't put module config in a central place | |
if $osUser == undef { $real_osUser = $logstash::data::osUser } else { $real_osUser = $osUser } | |
if $version == undef { $real_version = $logstash::data::version } else { $real_javaMx = $javaMx } | |
if $installDir == undef { $real_installDir = $logstash::data::installDir } else { $real_installDir = $installDir } | |
if $downloadUrl == undef { $real_downloadUrl = $logstash::data::downloadUrl } else { $real_downloadUrl = $downloadUrl } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment