Project

General

Profile

Feature #2260

Support dynamic ERB parameters in global and class params

Added by Greg Sutcliffe about 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
External Nodes
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Sometimes you want to pass information that Foreman knows (such as hostnames, IPs, MACs, subnets, etc) to Puppet through the ENC. At present it is not possible to do

parameters:
test: '<%= @host.name %>'

or

classes:
puppet:
certname: '<%= @host.certname %>'

Foreman will simply send this static string to Puppet. It would be nice to be able to send dynamic data to Puppet via ERB, just like we do in the templates.


Related issues

Related to Foreman - Feature #1107: variables in settingsClosed2011-08-11

Associated revisions

Revision 84ae9603 (diff)
Added by Greg Sutcliffe over 9 years ago

fixes #2260 Allow ERB in ENC global / class parameters

Adds code to parse the global & class parameters, and adds a setting (default true)
to disable this if needed. Also has some tests.

History

#1 Updated by Ohad Levy over 9 years ago

  • Description updated (diff)
  • Target version set to 1.3.0

#2 Updated by Greg Sutcliffe over 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal over 9 years ago

#4 Updated by Glen Ogilvie over 9 years ago

This looks like what I am looking for, but don't seem to be able to do everything I would expect, like:


classes:
  envtest:
    two: <%= scope.lookupvar(envtest::params::one) %>

or


classes:
  envtest:
    two: '<%= @envtest::params::one) %>'

Should ERB functions work? and should it be possible to lookup other variables set in Foreman, rather than just facts?

#5 Updated by Dominic Cleal over 9 years ago

There's a difference between ERB templating in Foreman and in Puppet, as it changes what variables you'll have access to. This feature allows for interpolation as per TemplateWriting in Foreman, which is long before Puppet classes and parameters are available. You won't be able to reference any Puppet ERB functionality from Foreman.

Also available in: Atom PDF