Sorry, that should be
$puppetserver = $puppet::params::puppetserver
-Eric
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com (mailto:puppet-users+unsub...@googlegroups.com).
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com (mailto:puppet-users+unsub...@googlegroups.com).
First off, it's important to distinguish import from include. They "feel" like similar concepts but they're not - import goes and physically loads a file. Include says "ensure that this class is part of this host's resource graph."
It's important not to think of Puppet in procedural, top-down terms. We haven't just said, "give me all the stuff in this class, and now do these things." Rather we are building a model of a server, and manifest code simply informs pieces of that model. So by saying "include <class>" you are really saying, "Puppet, if you haven't already, make sure this class is part of the overall resource graph."
The better model for this example is, rather than a box inside of a box, you are looking at two sealed boxes sitting side by side. When you include the first group, it is added to the list of boxes used. Within the first box, when you then say "give me the second box," that second box is placed *alongside* the first. Thus in order to grab anything from it, you have to specify "I need the stuff from box 2."
Does that analogy help a bit more?
The reason for this is that, as your number of classes grows, so too will your variables. If they share a single global namespace, the likelihood of a global variable name being used more than once increases. This can lead to really unexpected changes and ambiguity in building the graph.
An example: suppose is this module you say $puppetmaster = "myserver.local" and in another module, you want to only run on a puppet master and so say $puppetmaster = true. When Puppet assembles the model of your system, which of the two is to be applied where? Dynamic scoping tried to guess at this. The idea here is to say, eliminate ambiguity - tell us exactly which one you want.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
An example: suppose is this module you say $puppetmaster = "myserver.local" and in another module, you want to only run on a puppet master and so say $puppetmaster = true. When Puppet assembles the model of your system, which of the two is to be applied where? Dynamic scoping tried to guess at this. The idea here is to say, eliminate ambiguity - tell us exactly which one you want.
zachary alex stern I systems architect | ceo - enter: narnia
o: 212.731.2033 | f: 212.202.6488 | z...@enternewmedia.com
60-62 e. 11th street, 4th floor | new york, ny | 10003
Ok, that's helpful, however:Sure, I get that, but I'm trying to do this within the module, not globally.On Sun, Aug 12, 2012 at 8:43 AM, Eric Shamow <er...@puppetlabs.com> wrote:
An example: suppose is this module you say $puppetmaster = "myserver.local" and in another module, you want to only run on a puppet master and so say $puppetmaster = true. When Puppet assembles the model of your system, which of the two is to be applied where? Dynamic scoping tried to guess at this. The idea here is to say, eliminate ambiguity - tell us exactly which one you want.Also imagine the following scenario.I've configured the params.pp file to contain various things like $puppet::params:puppetserver - but what if I want to override that in a particular manfiest, but use the same template erb file for configuration. I can't, because I've used the scope.lookupvar tool in the manifest, rather than just doing <%= puppetserver %> and having that variable take on a value based on context - not in terms of "dynamic scoping" but in terms of being able to, as discussed, include params.pp, or define it inside the manifest that is using the template.Is there any way to achieve this on-the-fly variable-changing, short of using hiera or something like that? I'm just not there yet.
class puppet ($server = $puppet::params::server) include puppet::params {...}
class puppet ($server = $puppet::params::server) include puppet::params {...}If I'm already specifying scope, e.g. $server = $puppet::params::server, why do I also need the include?
class puppet ($server = $puppet::params::server
) inherits puppet::params {
Sorry typo:class puppet ($server = $puppet::params::server) inherits puppet::params {
include puppet::params$puppetserver=$puppet::params::puppetserver$runinterval=$puppet::params::runinterval
file { '/etc/puppet/puppet.conf':ensure => present,content => template('puppet/puppet.conf.erb'),
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
zachary alex stern I systems architect
o: 212.731.2033 | f: 212.202.6488 | z...@enternewmedia.com
That's a fair point, but not applicable to my use-case (multiple puppet servers).However, at some point in the near future, I'll be using hiera, and that will be moot.
To use multiple Puppet masters for the same site and retain your sanity, it is essential that all site-wide classes and data be automatically synchronized across the masters.