You should use a subclass with an override, like so:

class postfix-special inherits postfix {
   File["/etc/postfix/main.cf"]{
     content => template("apps/postfix/main.cf.special.erb") }

node special {
   include baseclass
   include postfix-special }

That should get you the desired behavior without copying the entire
class and having to keep them in sync.

On Dec 12, 3:59 pm, "Ben Beuchler" <ins...@gmail.com> wrote:
> I've just built a simple class to manage Postfix.  That class is
> included in "baseclass" which is included in my default node.  My
> intent is that "baseclass" and "basenode" install and configure all of
> the packages that are common across all of my nodes.  However, some of
> the more specialized nodes will require a different Postfix config.
>
> Since those nodes inherit the standard Postfix config included in
> "basenode", what's the best way to configure them to retrieve a
> different main.cf file for their Postfix install?
>
> Do I need to create different Postfix classes for each of the types of
> nodes that only differ by their "content =>" line?  There must be a
> cleaner way.
>
> My current config is included below.
>
> Thanks!
>
> -Ben
>
> # classes/postfix.pp
> class postfix {
>     package { "postfix": ensure => present }
>     service { "postfix": ensure => running }
>     file { "/etc/postfix/main.cf":
>         content => template("apps/postfix/main.cf.base.erb"),
>         notify => Service["postfix"],
>         require => Package["postfix"],
>     }
>
> }
>
> # classes/baseclass.pp
> class baseclass {
>     include postfix
>     include vim
>     include basefiles
>     include sudo
>     include ntp::server
>
>     package {
>         "syslog-ng": ensure => present;
>         "tcsh":      ensure => present;
>     }
>
> }
>
> # nodes.pp
> node default {
>     include baseclass
>
> }
--~--~---------~--~----~------------~-------~--~----~
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