On Apr 27, 3:52 am, Peter Meier <peter.me...@immerda.ch> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> > [0] I have various nodes defined by function (e.g. database server) that
> > inherit from a base node. One thing the base node does is check a fact
> > that returns the location of the client. It then includes a module with
> > the location-specific configuration, such as the ntp server.
>
> so you include in the base the ntp module and set the $ntp_servers
> variable in the sub-node? Yes, this will not work as when the ntp class
> is included the ntp_servers are not yet set.
>

I think I understand why that wouldn't work, but that's not what I
tried. I set the variable and include the module at the same level, as
in the example I posted. These two lines are always in the same file.

In my first attempt, the way it worked was I had this in my base node.

case $location {
  foo: { include foo::base }
  bar: { include bar::base }
  default: { error("Cannot determine at what university $fqdn is
located") }
}

and then in foo::base I had

include ntp

since that location was using the default value, and in bar::base I
had

$ntp_servers = ["timeserver1.example.edu", "timeserver2.example.edu"]
include ntp

since it was using a custom value. However, the value of $ntp_servers
wasn't being set properly for hosts at location bar, hence my post.

In my second attempt I moved everything related to ntp out of
foo::base and bar::base modules and into the base node, like so

include ntp
case $location {
  foo: {
  include foo::base
  }
  bar: {
    $ntp_servers = ["timeserver1.example.edu",
"timeserver2.example.edu", "timeserver3.bar.edu"]
    include bar::base
  }
  default: {
    error("Cannot determine at what location $fqdn is located")
  }
}

However, that still did not work. Should either of these have worked?
Why or why not? Could either be tweaked to work?

All the best,
Brian Pitts

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