On Tue, Apr 4, 2017 at 4:41 PM, warron.french <warron.fre...@gmail.com>
wrote:

> Hello, I need some guidance/direction on what to lookup and where I can
> find an example of how to provide values to a class so that they will be
> used by the class (and the ERBtemplate within).
>
> I want to be able to provide the variable *collector_id* to my class and
> from the Red Hat Satellite Puppet Master provide collector_id =
> mycollector.some.net so that it will be used to generate text and then
> populate -    mycollector.some.net in the file after some other text.
>
> I figured something like this is needed; but I am not sure and cannot find
> an example to confirm I am on the correct track:
>
> *class* rsyslog_mgmt (collector_id) {
>     file { '/etc/rsyslog.conf':
>            ensure  => 'present',
>            content => template('rsyslog_mgmt/syslog.conf.erb'),
>     }
> }
>
> Then the content of my file syslog.conf.erb would look something like this:
>
> ...snippet...
> *.info;authpriv.*;mail.none;news.none              <%= @collector_id %>
> ...EOF...
>
> Am I on the correct track?  Do I need a $ symbol in front of the
> collector_id within the () at the top in front of the first curly brace
> that starts the class definition?
>

You need the dollar sign:

class blah(
    $parameter_1,
) {
    ..do stuff
}

Search for "parameterized class puppet" for further reading.

-m

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOLfK3WbVqcH9KMQ-9mcrcDTshfAHDejtd3GZw7%3DHhjwCrXDqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to