On Thu, Dec 20, 2012 at 4:11 PM, Steve Button <steve.but...@gmail.com> wrote:
> Hi,
>
> I've written a new resolv class, but I only want it to get pushed out (for
> instance) UAT servers for now. Or perhaps just servers which have apache
> installed, or just the ones which are part of project xyz.

Depending on the size and complexity of your environment, there's
several ways of achieving those goals.

> I've been searching through the docs, but I think I'm looking in the wrong
> place. Also, I get the feeling that there's several ways to achieve this and
> some of the docs refer to the older ways.

Yes, there are several ways, and I think the docs cover all of them,
at least to a certain degree.

> What's the current method of limiting certain manifests to certain classes
> of machines? (have I got my terminology wrong here?)

Using the word 'classes', whilst not incorrect, may cause confusion,
as a class is something special in puppet terminology.

> Perhaps someone could put a link in to the best place in the docs that
> explains this to me? I'm sure I've read about this in the past, but I can't
> seem to find it again.

OK.  If you're trying to apply your resolv class based on the fact
that Apache is installed, I'd recommend resource dependencies (docs at
http://docs.puppetlabs.com/learning/ordering.html):

apache { 'vhost-title':
  parameter => value,
  param2 => value,
  before => resolv['resolv.conf']
}

I personally don't like having dependencies ordered that way (I prefer
'require'), but given your use case of 'I know which servers I want
Apache on, and resolv needs to be put on those same servers' this
seems to be the more natural way of writing your manifest.

The most flexible way of assigning classes to nodes is via an External
Node Classifier, or ENC.  Documentation at
http://docs.puppetlabs.com/guides/external_nodes.html.  I think this
is generally considered the 'correct' method, given that manually
updating site.pp is just unworkable in any large(ish) setup.

For your 'I want to assign the class to all servers in XYZ project',
the first question you have to answer is 'how do you define which
servers are in project 'xyz'.  If it's hostname based, your ENC has
direct access to that (the ENC script is called with the hostname as a
parameter).  If it's some other property of the server, it may already
be available as a facter variable, which are easily obtainable via
calling out to the 'facter' binary in your script.  If it's some other
property, you'll have to somehow make that available to your ENC
script.  That could be done via a custom fact, which is documented at
http://docs.puppetlabs.com/guides/custom_facts.html.

Regards,

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@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