Hello,

I'm new to puppet, so maybe this is a silly question, but an hour of
googling has thrown up nothing.

I am trying to define a set of classes which each represent different
server types in my architecture, for example "dns server" and "web
server".  A single machine may perform more than one server role - eg
it could be both a dns server and a web server.

For the types of roles I have, lets call them foo and bar, there are
some packages in common.  Eg they both require tomcat and jre.  So to
start off with I tried this:

class foo {
  package { jre-jce:                  ensure => present}
  package { tomcat:               ensure => '6.0.20-1'}
  package { foo-services:     ensure => present}
}

class bar {
  package { jre-jce:                  ensure => present}
  package { tomcat:               ensure => '6.0.20-1'}
  package { bar-services:     ensure => present}
}

node 'server1' {
        include foo
        include bar
}

This works fine if I only include one class or the other in the node
definition, but if I include both then I get an error "Package[jre-
jce] is already defined in file ...; cannot redefine at ..."

So now I am trying to find a way to move the package definitions
outside of the class definitions, and reference them from there.  But
I can't find a syntax which allows me to do that.  The closest I have
come is this:

package { jre-jce:                  ensure => present}

class foo {
  Package["jre-jce"] {}
}

but puppet doesn't like the empty braces.

Is there a better way to do what I am trying to do?  Or is this the
right way but the wrong syntax?

Thanks for any help.

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to