Puppet profile with Foreman Smart Class Parameter override

asked 2018-10-16 07:55:15 -0600

updated 2018-10-17 08:00:32 -0600

DarylW gravatar image

I have a need to pass a Foreman Host Group parameter to a Puppet module where it will be used in a template like so:

Create the component module

   class my_module (
      $foreman_param,
    ){
      file { 'my_file':
        ensure  => 'file,'
        content => epp(my_module/my_template.epp, { foreman_param => $foreman_param }),
      }
    }

Create the template

my_value = <%= $foreman_param %>

Import the module into Foreman and override it's value with an ERB template containing the Host Group Parameter

image description

Everything up to here works as expected. The Foreman ENC inserts a dynamic value for $foreman_param based on the nodes host group.

The issue arises when I add my_module to a profile class. All of my attempts so far have resulted in Class my_profile expects a value for parameter $foreman_param type errors during puppet runs on a test node.

This doesn't work:

class my_profile {
      include my_module
}

Nor does this with the Foreman Smart Class Parameter override replicated for my_profile::foreman_param:

class my_profile (
  $foreman_param,
){
  include my_module
}

Any ideas on what my problem is here?

edit retag flag offensive close merge delete