As Patrick mentions, one solution i recommend is to enable storeconfigs and
have each node export a host entry for itself tagged with the tag you want
other hosts to collect.

For example, each node may export it's host entry with:
@@host { "$fqdn": ip_address => $ipaddress, tags => "webserver" }

The cluster may collect these resources to build the hosts file with:

Host <<|| tag == "webserver" ||>>

On my phone, so parameter names may not be perfect.

Hope this helps,
--
Jeff McCune - (+1-503-208-4484)

On Jul 12, 2010, at 8:54 AM, Patrick Mohr <kc7...@gmail.com> wrote:

Take a look at http://docs.puppetlabs.com/guides/exported_resources.html.  I
think this will give you what you want.  *It will only work if you turn on
storeconfigs.*


On Jul 12, 2010, at 5:43 AM, CraftyTech wrote:

Thanks for the feedback Jeff.  Interesting feature that I had
unfortunately overlooked until now, but the basic question still
remains; how would I then generate specific hostfiles based on nodes
of the same tag? For instance, a web server to only have host entries
for items tagged webserver only, and not one large on-size-fits-all
file.  Thanks,

On Jul 2, 9:39 pm, Jeff McCune <j...@puppetlabs.com> wrote:

On Wed, Jun 30, 2010 at 10:40 AM, CraftyTech <hmmed...@gmail.com> wrote:

Hello All,


    Can someone point me in the right direction here.  I'm trying to

create an erb template for my /etc/hosts file, so that when executed,

it populates the /etc/hosts file only with entries that are tag

relevant.  For instance, if a server is tagged apache, only the apache

tagged entries would be populated into the /etc/hosts file.  Thanks in

advance for you help.


I recommend using the built in host type to model and manage entries

in /etc/hosts rather than a template.


Modeling your configuration using a type rather than a file will allow

you to declare the resources as virtual, then simply realize them if

they're tagged with the tag you care about.  In addition, you'll

receive a bunch of additional features "for free" like the

relationship graph, meta-parameters, reporting, etc...


For example:


class apache {

  @host { "zaphod": ip => "1.2.3.4" }


}


# Realize host entries tagged with "apache"

Host <| tag == "apache" |>


--

Jeff McCunehttp://www.puppetlabs.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.


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

Reply via email to