Le 18/03/2011 00:03, Ashley Gould a écrit :
> I am exploring usage of parameterized classes.  I hit a wall when
> trying to override values of parameters in a node definition that 
> inherits the class from a parent node.  Is there a way to do this,
> or must I include the class only in the child node?
I'm also facing the same issue, except I'm rather interested in the
result (managing specific case of a policy applied everywhere from basic
node definition) rather than the exact way to achieve it (parameterized
classes, defined type, whatever).

This is true for instance for ntp, ssh, syslog, etc... Basically every
kind of service running as server on all machines with the same
configuration excepted in a specific node, the master (smtp or ssh
gateway, ntp master, etc...).

Currently, I'm managing this by hardcoding conditional in the class, but
I don't like mixing the semantic of "how to run a service" with "how do
map my services to my infrastructure".

node "basenode" {
    include ntp::server
}

node "ntp.tld" inherits basenode {
}

class ntp::server {
    $servers = $hostname ? {
        ntp => ["ntp.foo", "ntp.bar", "ntp.baz"],
        default => "ntp.tld"
    }
}

I could potentialy move the conditional into the "basenode" definition,
which would achieve a bit more separation of concerns, but would be
quite ugly. What I'd really like would be some way to express:

node "basenode" {
    include ntp::server (with servers = "ntp.tld")
}

node "ntp.tld" inherits basenode {
    include ntp::server (with servers = ["ntp.foo", "ntp.bar", "ntp.baz"])
}
-- 
BOFH excuse #82:

Yeah, yo mama dresses you funny and you need a mouse to delete files.

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

Reply via email to