Hi Ken,
I have a module that will set the forwarding IPs in the
snmptrapd.conf:
-----------------------------------------------------------------
My init.pp file for the module is as follows
------------------------------------------------------------------
class snmp
{
    file {
        "snmptrapd.conf":
           name => $operatingsystem ? {
              CentOS => "/etc/snmp/snmptrapd.conf",
           },
           owner  => "root",
           group  => "root",
           mode   => 644,
           content => template("snmp/snmptrapd.conf.erb"),
    }# file

    # Make sure snmptrapd is runnning and restart
    # it  when snmptrapd.conf changes.
    service {
           "snmptrapd":
               subscribe => File["snmptrapd.conf"],
               ensure    => running,
               restart   => "/etc/init.d/snmptrapd restart",
    }# service
}# snmp

-------------------------------------------------------------------
My snmptrapd.conf.erb contains the following:
-------------------------------------------------------------------

<% snmpForwardToIpList.each do |snmpForwardToIp| -%>
forward default <%= snmpForwardToIp %>
<% end -%>

-------------------------------------------------------------------
I have an external data file that contains:
-------------------------------------------------------------------
default,host1,host2,host3
testsnmp,host1,host2

------------------------------------------------------------------
In my site.pp file I have the following
-----------------------------------------------------

node default {
   include snmp
}

If $host in testsnmp {
    $snmpForwardToIpList = ["10.10.10.10","10.10.10.11"]
} else {
    $snmpForwardToIpList = ["10.10.10.12","10.10.10.13"]
}

-----------------------------------------------------------------------------------
Now lets say I add a new entry to the external data file
and want the "newsnmptest" to take priority.
------------------------------------------------------------------------------------
default,host1,host2,host3
testsnmp,host1,host2
newsnmptest,host1

----------------------------------------------------------------------------------
Given this change, I now have to update the conditional
in my site.pp file:
--------------------------------------------------------------------------------

If $host in $newsnmptest {
    $snmpForwardToIpList = ["10.10.10.08","10.10.10.09"]
} elsif  $host in $testsnmp {
    $snmpForwardToIpList = ["10.10.10.10","10.10.10.11"]
} else {
    $snmpForwardToIpList = ["10.10.10.12","10.10.10.13"]
}


I am new to puppet. It seems like the situation I describe would be
something typical but I don't think I am handling it very elegantly.


On Dec 18, 4:46 am, Ken Barber <k...@bob.sh> wrote:
> I'm not sure I follow? Perhaps an example of what you are trying to achieve
> would help.
>
> ken.

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