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 McCune
http://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.

Reply via email to