Overriding class parameters within Foreman

32 views
Skip to first unread message

Kyle Flavin

unread,
Feb 4, 2016, 8:25:51 PM2/4/16
to Puppet Users
We're using Foreman to manage puppet.  I'm trying to create a class that uses the default value of $::domain, for $dhcp_dnsdomain, unless the parameter is defined as a host parameter within Foreman.  For example:

class foreman_proxy (
  $dhcp_dnsdomain     = $::domain,
  $nameservers        = ['10.0.0.1',],
) {
    file { "/path/to/file":
        ensure => present,
        mode   => '0755',
        content => template("foreman_proxy/mytemplate.erb"),
    }
}

I'd like $dhcp_dnsdomain to default to the host's facter value of $::domain if no host parameter is specified in Foreman.  If $dhcp_dnsdomain is given in Foreman, I want that to be used instead of the default. 

In the example above, I'm unable to override $dhcp_dnsdomain by setting the corresponding value on the host in Foreman.  It always goes with the value of $::domain.

Is there a way to do this?

Felix Frank

unread,
Feb 11, 2016, 5:38:55 PM2/11/16
to puppet...@googlegroups.com
On 02/05/2016 02:25 AM, Kyle Flavin wrote:
> In the example above, I'm unable to override $dhcp_dnsdomain by
> setting the corresponding value on the host in Foreman. It always
> goes with the value of $::domain.

Could you describe more specifically what you are setting where?

Adding a variable called $dhcp_dnsdomain to the node will not help. It
must be added to the class. Perhaps you can share a screenshot?

Cheers,
Felix
Reply all
Reply to author
Forward
0 new messages