Hi,

I believe I have a related problem.  What is the correct way to extend your
example, to handle the situation where each application class needs to set a
different var?  For example I'm writing a module whereby I need to include
sections of template based on what applications are installed on the
server.  So for example I currently have:

   class syslog {
   ...
      $include_networker = ''
      $siem_collector_ipaddr = ''

      file { $syslog_config:
         owner   => 'root',
         group   => 'root',
         mode    => '0644',
         content =>
template("syslog/${operatingsystem}/${cust_os_major_version}/config.erb"),
         require => [ Package[$syslog_pkg] ],
      }
   ...
   }

#===

My erb template contains the standard syslog plus the following sections at
the end:

<% if !include_networker.empty?  then %>

# NetWorker requirements
daemon.notice                   /dev/console
daemon.notice                   /nsr/logs/messages
daemon.notice                   operator
local0.notice                   /nsr/logs/summary
local0.alert                    root, operator
<% end -%>
<% if !siem_collector_ipaddr.empty? then %>

# SIEM requirements
*.debug @<%= siem_collector_ipaddr %>
<% end -%>

#===

   class syslog::add_config inherits syslog {

      # Do something to set the params in the template if required ?????
      # I have tried different approaches including appending each
application to an array and modifying template to read it (which doesn't
work); setting
      # application specified params to be picked up in the template etc.

      # This resets the content of the file resource in syslog
      # to enable the application inclusions in the template to be picked
up.
      #
      File[$syslog_config] { content =>
template("syslog/${operatingsystem}/${cust_os_major_version}/config.erb") }
   }

#===

   class siem ($siem_collector_ipaddr) {
      ...
      include 'syslog::add_config'
      ...
   }

#===

   class  networker {
      ...
      $include_networker = 1
      include 'syslog::add_config'
      ...
   }

#===

The vars $include_networker and $siem_collector_ipaddr in class syslog do
not get set.  I should add that I am aware augeas will be suggested for
syslog configs :) but we have both RHEL 5/6 and Solaris 10 servers, and I'm
yet to fully evaluate it to ensure it will suit all our needs for all
platforms.

Thanks in advance,
Karen

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