passing argument to a class or a module

56 views
Skip to first unread message

Olivier

unread,
Jan 26, 2012, 4:40:34 PM1/26/12
to Puppet Users
I see plenty of examples of classes or modules such as ntp or sudo or
ssd. But none of these examples pass an argument to a class or a
module. If I wanted to pass the rpm name to a module or a class, what
would be the call to that class in site.pp and what would be the
class definition in init.pp?

Thank you

Joehillen

unread,
Jan 26, 2012, 5:22:26 PM1/26/12
to puppet...@googlegroups.com
You can't pass arguments to classes, only defines.

Nan Liu

unread,
Jan 26, 2012, 5:48:23 PM1/26/12
to puppet...@googlegroups.com
On Thu, Jan 26, 2012 at 5:22 PM, Joehillen <joeh...@gmail.com> wrote:
> You can't pass arguments to classes, only defines.
>

Classes support parameters since 2.6.0, here's the documentation:
http://docs.puppetlabs.com/learning/modules2.html

Nan

Joehillen

unread,
Jan 26, 2012, 6:47:44 PM1/26/12
to puppet...@googlegroups.com
whoa, my bad. I learned puppet before 2.6

Now I don't know why there is a distinction between classes and defines. I'll have to read up.

Thanks

Olivier

unread,
Jan 26, 2012, 7:51:37 PM1/26/12
to Puppet Users
Thank you

On Jan 26, 5:48 pm, Nan Liu <n...@puppetlabs.com> wrote:

Ryan Bowlby

unread,
Jan 26, 2012, 9:20:11 PM1/26/12
to Puppet Users
Classes can only be declared once while defines can be declared
multiple times. So if you wanted two vhost files a define would be
needed.
Reply all
Reply to author
Forward
0 new messages