Sounds pretty much like the problem I posted yesterday. You may have a look at it here: http://groups.google.com/group/puppet-users/browse_thread/thread/336a6c1d941acca8/b50faf7711b7bf41?hl=en&lnk=gst&q=adamowicz#b50faf7711b7bf41.
It seems that external node definitions and different environments are the solution for our problems. Just search the Puppet-Wiki and you'll get the information on theses topics. Bernd > -----Ursprüngliche Nachricht----- > Von: puppet-users@googlegroups.com [mailto:puppet- > us...@googlegroups.com] Im Auftrag von Brian Pitts > Gesendet: Dienstag, 27. April 2010 03:54 > An: puppet-users@googlegroups.com > Betreff: [Puppet Users] Setting Variable in Class or Node and Using in > Included Module > > Should the following approach to optionally including site-specific > information in modules work? It's the third pattern documented at > http://serialized.net/2009/07/puppet-module-patterns/ > > In my case, I have > > modules/manifests/ntp/init.pp > > import "classes/*" > > if ($ntp_servers) { > $servers = $ntp_servers > } else { > $servers = ["0.rhel.pool.ntp.org", "1.rhel.pool.ntp.org", > "2.rhel.pool.ntp.org"] > notice("ntp: ntp_servers not set. Using red hat's by default.") > } > > modules/manifests/ntp/classes/ntp.pp > > class ntp { > package { "ntp": > ensure => installed; > } > service { "ntpd": > enable => true, > ensure => running, > subscribe => File["/etc/ntp.conf"]; > } > # template iterates over values in $servers array > file { "/etc/ntp.conf": > ensure => file, > owner => "root", > group => "root", > mode => "644", > content => template("ntp/ntp.conf.erb"); > } > } > > And then in different classes [0] I set the ntp servers and include the > module like: > > $ntp_servers = ["timeserver1.example.edu", "timeserver2.example.edu"] > include ntp > > I often receive the error message "Failed to parse template > ntp/ntp.conf.erb: Could not find value for 'servers' at > /etc/puppet/modules/ntp/manifests/classes/ntp.pp:19 on node > foo.example.edu" or my own notice() from the manifest above during > runs. > > I tried moving setting $ntp_servers from a class into a node, but that > did not make a difference. > > Can anyone point out what I'm doing wrong or why this approach won't > work? I've read quite a bit on variable scope on the mailing list and > wiki, but I could still be missing something. I'm running puppet 0.24.8 > on RHEL5. > > [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. > > -- > Brian Pitts > Systems Administrator | EuPathDB Bioinformatics Resource Center > 706-542-1447 | b...@uga.edu | http://eupathdb.org > > -- > 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. -- 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.