I am trying to wrap my head around using templates and was wondering
what the execution context was, puppetmaster or client? I thought it
was client since it would have to also account for facter-based
variables, but recent testing on something I thought was pretty neat
turned out to cause puppetmaster to segfault in an apparent attempt to
evaluate the template on the server side. The template section I was
using was:
%# This section generates a cfg_dir directive for each directory
%# found within /etc/nagios/client (if any).
<% require ''pathname'' %>
<% p = Pathname.new("/etc/nagios/client") %>
<% if File.directory?(p) then %>
# Include any per-client directories specified in the site definition.
<% Dir.glob(File.join(p,"*")).each do |val| %>
<% if File.directory?(p+val) then %>
cfg_dir=<%= p+val %>
<% end %>
<% end %>
<% end %>
I am pretty much learning Ruby on the fly as I work through this, so be
gentle with me :). The goal here is to make a nagios.cfg file be able
to locally determine if there is a /etc/nagios/client directory and
include each as a configuration directive. Regardless of whether this
is the right way to handle the requirement, I''m more curious now
whether
using templates in this way is (a) possible and (b) sensical. I felt as
I was doing it that I was violating the philosophy of puppet and I think
I was punished for it :).
Thanks,
Mark