On 30 June 2010 18:40, 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.


This is possible with `if all_tags.include?("<sometag>")`.

But, and a big but, it is highly dependent on the order which your modules
are compiled[0]. It will prove unreliable if your Apache module happens to
be `included` after the module which is creating the templated hosts file.
For this reason it will introduce extra use complexity into your modules and
most people will probably recommend that you use facts instead.

It happens to be a bit of a bug bear of mine because it is otherwise quite a
useful feature that precludes the mess of populating additional facts. The
conundrum is similar to a recent thread[1] entitled "do X if package Y is
installed".

[0] That is "compiled" by the puppetmaster. Not "executed" by the puppet
client.
[1]
http://groups.google.com/group/puppet-users/browse_thread/thread/b037fa88eb09b8ae

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