Using Foreman global variables as class parameters

Hello,

My name is Daniel and I am in the middle of integrating Foreman in our
company infrastructure. Until now, it is a very smooth process and working
quite well. But I think I might have some misunderstandings when I want to
use Foreman global variables in class parameters:

  1. Foreman, I have a global parameter set myparam -> testvalue_from_foreman
    2 In puppet: notify{'Test', name => $::myparem} -> testvalue_from_foreman

so this is working quite well.

But how do I use global variables in class parameters?

  1. In Foreman, override the class parameter, type string - 'localparam'
    with: $::myparam
  2. In puppet, notify{'Test', name => $localparam} -> $::myparam

How do I get the $::myparam expanded? I already tried in foreman:
"${::myparam}", but I suppose my value is passed to pupped as
'$::myparam'…

Thanks!
Daniel

Hello Daniel,

Foreman allows you to also override the puppet class parameters using smart class params (inside the puppet class edit form).
For more information, take a look at this section of the manual:
http://theforeman.org/manuals/1.8/index.html#4.2.5ParameterizedClasses

··· -- Have a nice day, Tomer Brisker

----- Original Message -----
From: “Daniel Helgenberger” daniel@helgenberger.net
To: foreman-users@googlegroups.com
Sent: Wednesday, June 10, 2015 5:30:47 PM
Subject: [foreman-users] Using Foreman global variables as class parameters

Hello,

My name is Daniel and I am in the middle of integrating Foreman in our
company infrastructure. Until now, it is a very smooth process and working
quite well. But I think I might have some misunderstandings when I want to
use Foreman global variables in class parameters:

  1. Foreman, I have a global parameter set myparam -> testvalue_from_foreman
    2 In puppet: notify{‘Test’, name => $::myparem} -> testvalue_from_foreman

so this is working quite well.

But how do I use global variables in class parameters?

  1. In Foreman, override the class parameter, type string - 'localparam’
    with: $::myparam
  2. In puppet, notify{‘Test’, name => $localparam} -> $::myparam

How do I get the $::myparam expanded? I already tried in foreman:
"${::myparam}", but I suppose my value is passed to pupped as
’$::myparam’…

Thanks!
Daniel


You received this message because you are subscribed to the Google Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

>
> Hello Daniel,
>
Hello Tomer,

>
> Foreman allows you to also override the puppet class parameters using
> smart class params (inside the puppet class edit form).
> For more information, take a look at this section of the manual:
> Foreman :: Manual
>

Indeed, I read this before posting. However, further testing shows I most
likely misunderstand the 'string' type or it is broken.

Example:
I set a class parameter 'ssl_ca_bundle' as sting, value:
'puppet:///mbox_files/mbox-ssl/ca-bundle-client.crt'

I get:
Error: Failed to apply catalog: Parameter source failed on
File[/etc/pki/tls/certs/ca-bundle-client.crt]: Could not understand source
'puppet:///mbox_files/mbox-ssl/ca-bundle-client.crt': bad URI(is not URI?):
'puppet:///mbox_files/mbox-ssl/ca-bundle-client.crt' at
/etc/puppet/environments/puppettest/modules/confluence/manifests/init.pp:76

Or, using as value a global parameter like ${$::g_ssl_key}
Error: Failed to apply catalog: Parameter source failed on
File[/etc/pki/tls/private/m-box.de.key]: Could not understand source
${$::g_ssl_key}: bad URI(is not URI?): $%7B$::g_ssl_key%7D at
/etc/puppet/environments/puppettest/modules/confluence/manifests/init.pp:67

I work around this by using the array type. For instance,
['puppet:///mbox_files/mbox-ssl/ca-bundle-client.crt'] or
[$::g_ssl_key]

The foreman docs do not go in further detail, but I expected the 'sting'
type to be passed like this to puppet: "value" or even 'value'. Internally
it seems to be escaped for some reason beyond me.
$%7B$::g_ssl_key%7D

Thanks!

··· On Thursday, June 11, 2015 at 9:23:47 AM UTC+2, Tomer Brisker wrote:


Have a nice day,
Tomer Brisker

----- Original Message -----
From: “Daniel Helgenberger” <dan...@helgenberger.net <javascript:>>
To: forema...@googlegroups.com <javascript:>
Sent: Wednesday, June 10, 2015 5:30:47 PM
Subject: [foreman-users] Using Foreman global variables as class
parameters

Hello,

My name is Daniel and I am in the middle of integrating Foreman in our
company infrastructure. Until now, it is a very smooth process and working
quite well. But I think I might have some misunderstandings when I want to
use Foreman global variables in class parameters:

  1. Foreman, I have a global parameter set myparam ->
    testvalue_from_foreman
    2 In puppet: notify{‘Test’, name => $::myparem} -> testvalue_from_foreman

so this is working quite well.

But how do I use global variables in class parameters?

  1. In Foreman, override the class parameter, type string - 'localparam’
    with: $::myparam
  2. In puppet, notify{‘Test’, name => $localparam} -> $::myparam

How do I get the $::myparam expanded? I already tried in foreman:
"${::myparam}", but I suppose my value is passed to pupped as
’$::myparam’…

Thanks!
Daniel


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-user...@googlegroups.com <javascript:>.
To post to this group, send email to forema...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.