I think it is due to the Apache class being called inside your defined type, it is being called more than once when you try to create more than 1 vhost.
On Fri, Jun 8, 2018, 15:40 Clemens Bergmann <c.bergm...@proventa.de> wrote: > Hi There, > > I have a "can not redeclare" error that I do not understand. > > I try to write my own apache::vhost defined type with sane defaults for my > environment. > > The general class layout is as follows: > > class vhost::vhost1 { > custom::apache::vhost{ > #parameters > } > } > class vhost::vhost2 { > custom::apache::vhost{ > #parameters > } > } > define custom::apache::vhost () { > include custom::apache > } > class custom::apache { > class { '::apache': > #parameters > } > class { '::apache::mod::ssl': > #parameters > } > include apache::mod::authnz_ldap > include apache::mod::headers > include apache::mod::rewrite > include apache::mod::fastcgi > apache::listen { '443': } > } > > > > When I define only one custom::vhost then everything works fine. > But when I define multiple custom::vhost then I get the error "Duplicate > declaration: Class[Apache] is already declared;" which refers to the line > in class "custom::apache" where the "class { '::apache':" is defined. > > Can someone explain to me why I get this error? > > Thanks. > Clemens > > -- > 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/045a13d7-7bf0-4523-9067-8bbf73c26c89%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/045a13d7-7bf0-4523-9067-8bbf73c26c89%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CADZKzzbdn%3DrdydkFY7s3F%3DCRgFWzQ2LJ0TfR2dwBGm97o5m8xQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.