On May 6, 9:56 am, Peter Meier <peter.me...@immerda.ch> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> > I suspect we will turn 'node default' into 'class default', then include 
> > that
> > rather than inheriting that, since that does fix the scope issue.
>
> this is imho the way to go if you don't want to switch over to an
> external node tool.
>
> For each node I set some variables and then include exactly one class,
> which might a class similar to your default or a subclass of that one.
> And then we do all the overriding and setting default variables (if not
> set in the node) stuff within these (sub-)classes.
>
> This works pretty well and doesn't give you overloaded node statements.

That is one possible solution to the problem Daniel describes.
I'm having similar problems finding a good (and good-looking)
solution to group nodes and use node inheritance.

Suppose there are some different clusters with identical servers,
and a bunch of other, different servers. A lot of our modules
have classes that do:

class someclass {
    file { "/some/configfile":
        source => [
            "puppet:///module/configfile.$hostname",
            "puppet:///module/configfile.$cluster",
            "puppet:///module/configfile",
        ]
    }
}

Now suppose there are the following nodes:

node default {
    include someclass
    include someotherclass
    include anotherclass
    (...)
}
node /^imap\d+/ inherits default {
    $cluster = "imap"
    include dovecot
}
node /^webmail\d+/ inherits default { $cluster = "webmail" }
node /^mysql\d+/ inherits default {
    $cluster = "mysql"
    include databases
}
node /^webdisk\d+/ inherits default {
    $cluster = "webdisk"
    include apache
    include ldap
}

This is the way I'd like it to work, but is doesn't, because the
parent code is executed before the child code.

One solution is indeed to, as you say, put everything a single class
or
subclass, to not use inheritance. I don't like that solution very
much,
because that removes the complete configuration for any node from
sight,
while I've gone through great lengths to make the node-configuration
as
explicit as possible: node default for example, lists each class
included
class seperately. In a working environment with 20+ people managing
400+
hosts, you have to be as explicit as possible. But without repeating.

That is why I'd like to keep using node inheritance.
Is there no other way to accomplish this?

I've thought of another solution which allows for that, but it is
somewhat
of a kludge: I could create a define setlocal($cluster) and instead of
$cluster = "imap", I could say setlocal(cluster => "imap"), which
would
put this into a file on the node that is being processed. On the next
run of puppetd, a facter plugin would read that file and make $cluster
available in puppet. I haven't tried this yet, but I don't see why it
wouldn't work.

Any thoughts on this method?

-- 
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