Parameter confusion with foreman

Hi Folks:

I have several parameters (30+) defined in params.pp as such

class testclass::params {

case $::hostname {

/ABhostXY/: {

  $testvar1  = "0"
  $passwd    = "passwordtest"
  ...
  ...

}

}

I am now in a quandary as I cannot put plain text password in params.pp and
overriding just the password field in Foreman causes edits in 2 places for
new hosts that are added in params.pp. I want to avoid this. How can I,
with native Foreman smart var stuff, encrypt this password?

Or what would be a better way to do this while avoiding edits in 2 places:
params.pp and foreman UI.

Also, I am trying to prevent overriding all from foreman UI as there are
several parameters
and it is much easier to specify them in params.pp

Thanks
John

>
> Hi Folks:
>
> I have several parameters (30+) defined in params.pp as such
>
> class testclass::params {
>
> case $::hostname {
>
> /ABhostXY/: {
>
> $testvar1 = "0"
> $passwd = "passwordtest"
> …
> …
>
> }
>
> }
>
> I am now in a quandary as I cannot put plain text password in params.pp
and overriding just the password field in Foreman causes edits in 2 places
for new hosts that are added in params.pp. I want to avoid this. How can I,
with native Foreman smart var stuff, encrypt this password?
>
> Or what would be a better way to do this while avoiding edits in 2
places: params.pp and foreman UI.
>
> Also, I am trying to prevent overriding all from foreman UI as there are
several parameters and it is much easier to specify them in params.pp

It's only the case statement that is causing you 2 edits. I use a pattern
like this:

class mymodule::myclass (
$passwd = 'notarealpassword'
) {

}

Foreman is quite capable of supplying this $passwd string based on any
matchers you like using the Smart Class Parameters matchers. So for
example, I might have:

default: 12345678
hostgroup = Webserver: abcdefgh
host = foo.domain.com: awesomepassword

In this way, all the edits are solely in the Foreman UI, and there are no
code changes for new hosts, or for changing existing hosts.

Hope that helps
Greg

··· On 25 March 2016 at 20:07, John Test wrote: