# manifests/nodes
$nodetype = "base"
node "base" {
include postfix
...snip...
}
node "www01", "www02", ... , "www10" inherits "base" {
$nodetype = "wwwnode"
include postfix::custom
}
# modules/postfix/manifests/init.pp
class postfix {
package {"postfix": ensure => installed}
file {"/etc/postfix/main.cf":
content => template("puppet:///files/main.cf.erb})
}
}
# modules/postfix/manifests/custom.pp
class postfix::custom inherits postfix {
File ["/etc/postfix/main.cf"] {
content => undef,
source => ["puppet:///files/$hostname/main.cf",
"puppet:///files/$nodetype/main.cf" ]
}
}
This seems almost exactly the same as the "variable scope" example
from the language tutorial, but there's clearly a subtltly that I'm
missing. Can anyone point it out?
And is there a better way of accomplishing this? I'm trying to avoid
needing to create a unique class for every single kind of server while
at the same time trying to avoid a separate (identical) config file
for every server within a "kind".
Thanks...
-Ben