I looked for this for days now, and I'm quite depressed. We want to use Foreman as a monitoring and provisionnig tool. We would like to deactivate Foreman's ENC and use only Hiera. How could I manage that?

As to the why:

  1. my boss wants it like that.
  2. Foreman is not able to resolve a parameter coming from Hiera


define repo_file_manager (
  $repository_url = "http://${yum_client::lib::repository_server}/repos/${name}/",
  $ensure         = 'present',
  $gpgcheck       = '0',
  $enable         = '1') {

  $repoconfdir = '/etc/yum.repos.d'

  file { "${repoconfdir}/${name}.repo":
    ensure  => $ensure,
    group   => 'root',
    mode    => '0644',
    owner   => 'root',
    require => File['/etc/yum.repos.d'],
    content => template("yum_client/repofile.erb"),

${yum_client::lib::repository_server} returns nil, but when I do hiera(yum_client::lib::repository_server), I get the correct result.


Foreman is only an ENC, which means that it will send a YAML formatted set of classes and variables to the Puppet master when asked to do so.

If a variable is in Hiera, and you do not override it with Foreman, the variable in Hiera should automatically be used, as it will not be present in the YAML output. In newer version of Foreman, you can actually do both: use a default set with Hiera, but still be able to override that value with Foreman.

As to your question: iiuc, what you are creating is a defined type, which does not have the same data binding properties for Hiera as a class. What you probably want to do is call the hiera function instead of referring to a 'raw' variable in the defined type. That might require rewriting that type a bit, but it should work fine, whether or not you use Foreman as an ENC.

  • the problem is that wenn i use the same class withe the define on myoriginal puppet master evry is resoled correct,..., i cant use the hiera() call cause the deifine resives a hash and the default should only be used wenn no info is provided by the hash... and default should look like: $VAR = "blabla text ${hieravariable} blabla text" – Sukiyakijango Jul 16 '15 at 8:10
  • Thanks to you i found out where i have been thinking wrong.. – Sukiyakijango Jul 19 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.