Ask Your Question
0

Overwriting Puppet params.pp variables with Hiera

asked 2017-06-12 07:49:24 -0500

bjones gravatar image

I want to overwrite some default variables in the params.pp file in a Puppet module. The section I am looking to do this on is an if statement:

if $::osfamily == 'RedHat' {
$defaultsiteconfig    = {
  'appname'           => "${app_appname}",
  'Organization'      => "${app_organization}",
  'WebPath'           => "/opt/${package}${package_maj_version}",
  'WebPort'           => "${app_web_port}",
  'DatabaseType'      => "${app_database_type}",
  }
}

The variables:

${package}
${package_maj_version}
${app_web_port}
${app_database_type}

are working fine since they are being pulled from higher up in the params.pp file. The same is happening with:

${app_appname}
${app_organization}

(They come up blank since they are set to undef). But, I want them to pull from hiera instead:

app::app_appname: "example.org"
app::app_organization: "example.org"

Is there something in Puppet that prevents this from occurring in the params.pp file since other manifests can pull those hiera variables without issue?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-12 20:19:16 -0500

Red Cricket gravatar image

Hiera overrides class parameters not variables. You can set the variables to the value of a class parameter. See https://docs.puppet.com/hiera/3.3/pup...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-12 07:49:24 -0500

Seen: 39 times

Last updated: Jun 12