Declaring a cluss multiple times

Hi there

I'm a little confused on how to declare a puppet class multiple times with
foreman?

Let's look at the puppetlabs apache module [1] for example.

apache::vhost { 'first.example.com':
  port    => '80',
  docroot => '/var/www/first',
}

apache::vhost { 'second.example.com':
  port    => '80',
  docroot => '/var/www/second',
}

In my case I'm working on a logrotate module which should place multiple
files into /etc/logrotate.d/.
I'd love to configure these files based on hostgroups in foreman.

Is this even possible?
Any help is appreciated.

Thanks
Sandro

[1] http://forge.puppetlabs.com/puppetlabs/apache

ENC, it's how Puppet is written. You'll want to write a wrapper class,
place your defined resources within it, and call that from Foreman. There
are some examples on this mailing list if you go back a bit.

HTH
Greg

··· On 26 September 2013 08:45, Sandro Roth wrote:

Let’s look at the puppetlabs apache module [1] for example.

apache::vhost { 'first.example.com':

This is not a class, it’s a define. Defines cannot be placed within an

They are not multiple classes, they are multiple calls of a
parametrized class, no redefinitions of the class.

It's like a File resource that you call multiple times.

··· On Thu, Sep 26, 2013 at 10:45 AM, Sandro Roth wrote: > Hi there > > I'm a little confused on how to declare a puppet class multiple times with > foreman? > > Let's look at the puppetlabs apache module [1] for example. > > apache::vhost { 'first.example.com': > port => '80', > docroot => '/var/www/first', > } > > apache::vhost { 'second.example.com': > port => '80', > docroot => '/var/www/second', > } > > > In my case I'm working on a logrotate module which should place multiple > files into /etc/logrotate.d/. > I'd love to configure these files based on hostgroups in foreman. > > Is this even possible? > Any help is appreciated. > > > Thanks > Sandro > > > [1] http://forge.puppetlabs.com/puppetlabs/apache > > -- > 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/groups/opt_out.

Ahh ok, that makes sense.

Thanks a lot :slight_smile:
Sandro

··· On Thursday, September 26, 2013 10:28:12 AM UTC+2, Greg Sutcliffe wrote: > > On 26 September 2013 08:45, Sandro Roth <sandr...@gmail.com >wrote: > >> >> Let's look at the puppetlabs apache module [1] for example. >> >> apache::vhost { 'first.example.com': >> >> This is not a class, it's a define. Defines cannot be placed within an > ENC, it's how Puppet is written. You'll want to write a wrapper class, > place your defined resources within it, and call that from Foreman. There > are some examples on this mailing list if you go back a bit. > > HTH > Greg >