Hello all,

At the place where I work, we are using node inheritance to set up
variable environments that get used in templates.  We have a generic
environment node for each site that sets up things like DNS resolvers,
and domain names, etc.  We also have an application that needs its own
additional set of variables.  Moreover, this application has a set of
variables that are shared across sites, and a set of variables that are
site-specific.

Normally most nodes that correspond to machines would simply inherit the
generic variable nodes for each site.  However, for the machine nodes
that run this application, I was thinking that I would create a node to
contain the site-wide application variables.  Then I would create nodes
that would inherit this node that would contain the site-specific
application variables.  I would then have the machine nodes that run
this application inherit these nodes.  In order to have the application
nodes inherit the generic variable nodes, I was thinking that I could
include them into the site-specific application nodes.  However, the
include() function will only work on classes, not nodes, so this
approach seems to be at a standstill.

A diagram of what I was trying to do looks like the following:

gen1 = generic variable node for site1
gen2 = generic variable node for site2
s-w-app = site-wide application variable node
s1-app = application variables for site1
s2-app = application variables for site2
non-app1 = non-application machine at site1
non-app2 = non-application machine at site2
app1 = application machine at site1
app2 = application machine at site2

   gen1                       s-w-app                       gen2
   |   \                      /     \                      /   |
   |    \                    /       \                    /    |
inherit  include       inherit       inherit       include  inherit
   |            \      /                   \      /            |
non-app1         s1-app                     s2-app          non-app2
                    |                          |
                    |                          |
                 inherit                    inherit
                    |                          |
                   app1                       app2

One approach that I had thought of was to have the generic variable
nodes inherit the site-wide application node, and then have the
site-specific variable nodes inherit these.  This, however, feels more
like a hack than a solution, but it would work in a pinch.

A diagram for this would look like the following:

                                                    s-w-app
                                                    /     \
                                                   /       \
                                               inherit    inherit
                                                 /           \
                                             gen1             gen2
                                            /   |             |   \
                                           /    |             |    \
                                     inherit  inherit     inherit  inherit
                                     /          |             |          \
                                  non-app1    s1-app        s2-app   
non-app2
                                                |             |
                                               app1          app2

Alternatively, since include() is a function with code in
puppet/parser/functions, would it be possible to write a function that
could "include" the environment of another node?  If so, which parts of
the code would I want to look at to accomplish this?

Does anyone have any other ideas for what I am trying to accomplish?

Thanks in advance.

John Guthrie
jguth...@limewire.com

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