Have you looked at using hiera [1] for your configuration? It is very good
for cascading defaults with more specific config at the top of the
hierarchy and the least specific at the bottom. It is part of Puppet 3 and
an add on for 2.7.

  - Keith

[1]
http://www.devco.net/archives/2011/06/05/hiera_a_pluggable_hierarchical_data_store.php
 On 10 Feb 2013 06:00, "Roman Shaposhnik" <ro...@shaposhnik.org> wrote:

> Hi!
>
> suppose my puppet recipes are deploying a configuration
> for the entire cluster (lets say Hadoop) consisting of quite a
> few distributed systems (lets say distributed file-system --
> HDFS, scheduler -- YARN, coordinator -- zookeeper). Each
> of these distributed systems in turn consists of a few agents
> (e.g. in HDFS there's a NameNode, DataNode, etc.).
>
> My biggest concern is how to make it possible to cascade
> defaults in such a way that they can be specified at each
> of the levels: entire cluster, subsystem, an agent that
> is part of the subsystem.
>
> To be more explicit, suppose I have a node description
> that looks like this:
> -----------------------------------------------------------------
> class { "cluster::hdfs::datanode":
>    namenode_uri => "hdfs://foo.company.com",
>                 auth     => "kerberos"
> }
> class { "cluster::hdfs::secondary_namenode":
>     namenode_uri => "hdfs://foo.company.com",
>                auth      => "kerberos"
> }
> class { "cluster::zookeeper::server":
>     ensemble         => "zoo1.company.com",
>             auth         => "kerberos"
> }
> -----------------------------------------------------------------
>
> What would be the ideal way for me to not repeat myself
> and set auth as a cluster-level default, while having
> namenode_uri as an HDFS-level default?
>
> Really, what I need should look something like:
> ----------------------------------------------------------------------
> class { "cluster":
>    auth => kerberos
> }
> class { "hdfs":
>    namenode_uri => "hdfs://foo.company.com"
> }
> class { "cluster::hdfs::datanode": }
> class { "cluster::hdfs::secondary_namenode": }
> class { "cluster::zookeeper::server":
>     ensemble         => "zoo1.company.com",
> }
> ------------------------------------------------------------------------
>
> Any ideas on how this could be implemented? I've tried
> a couple of things, but so far no luck. The natural way
> of solving it via inheritance (e.g. cluster::hdfs inherits cluster
> and cluster::hdfs::datanode inherits cluster::hdfs, etc.)
> seems to be of no help at all. Another thing I was considering
> was something along the lines of:
>       class cluster::hdfs::datanode (
>           $auth = $cluster::hdfs::params::auth
>       ) inherits cluster::hdfs::params {...}
>       ..............
>       class cluster::hdfs::params {
>           if defined(Class['cluster::hdfs']) {
>               $auth = $cluster::hdfs::auth
>           } elsif defined(Class['cluster']) {
>               $auth = $cluster::auth
>           } else {
>               $auth = 'simple'
>           }
>       }
>
> seems to be pretty ugly and worse yet  dependent on the parsing
> order.
>
> Am I missing something obvious here?
>
> Thanks,
> Roman.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to