I'm trying to add a "node type" variable that can be interpolated into
source values.  In this, my latest attempt, $nodetype always ends up
as "base":

# 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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@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