From: Stephen Gran Date: Sun, 21 Feb 2010 03:19:04 +0000 (+0000) Subject: first stab at making puppet figure out info for nagios and munin master X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=06f8e083701d1c0886668573295fa2dc7bb7980c;p=dsa-puppet.git first stab at making puppet figure out info for nagios and munin master Signed-off-by: Stephen Gran --- diff --git a/manifests/site.pp b/manifests/site.pp index 1c719fe7..35de8860 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -48,13 +48,14 @@ node default { } } - case $hostname { - spohr: { + case extractnodeinfo($nodeinfo, 'muninmaster') { + "true": { include munin-node::master } } - case $hostname { - tchaikovsky: { + + case extractnodeinfo($nodeinfo, 'nagiosmaster') { + "true": { include nagios::server } default: { diff --git a/modules/ferm/files/defs.conf b/modules/ferm/files/defs.conf deleted file mode 100644 index 3e18b137..00000000 --- a/modules/ferm/files/defs.conf +++ /dev/null @@ -1,38 +0,0 @@ -## -## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. -## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git -## - -@def &SERVICE($proto, $port) = { - proto $proto mod state state (NEW) dport $port ACCEPT; -} - -@def &SERVICE_RANGE($proto, $port, $srange) = { - proto $proto mod state state (NEW) dport $port saddr ($srange) ACCEPT; -} - -@def &TCP_UDP_SERVICE($port) = { - proto (tcp udp) mod state state (NEW) dport $port ACCEPT; -} - -@def $HOST_MUNIN = (192.25.206.33); -@def $HOST_NAGIOS = (206.12.19.118); - -@def $sgran = (91.103.132.24/29); -@def $weasel = (); -@def $weasel = ($weasel 86.59.118.144/28); # debian@sil -@def $weasel = ($weasel 86.59.21.32/29); # anguilla1 -@def $weasel = ($weasel 86.59.30.32/28); # anguilla2 -@def $weasel = ($weasel 141.201.27.0/24); # came -@def $weasel = ($weasel 62.99.152.178); # argos.campus-sbg -@def $zobel = (); -@def $luca = (); -@def $DSA_IPS = ($sgran $weasel $zobel $luca); - -@def $sgran6 = (2001:4b10:100b::/48); -@def $weasel6 = (); -@def $weasel6 = ($weasel6 2001:826:408:200::/56); # came -@def $weasel6 = ($weasel6 2001:858:10f::/48); # anguilla -@def $zobel6 = (); -@def $luca6 = (); -@def $DSA_V6_IPS = ($sgran6 $weasel6 $zobel6 $luca6); diff --git a/modules/ferm/manifests/init.pp b/modules/ferm/manifests/init.pp index 3d35bae0..249d6b74 100644 --- a/modules/ferm/manifests/init.pp +++ b/modules/ferm/manifests/init.pp @@ -37,7 +37,7 @@ class ferm { mode => 0400, notify => Exec["ferm restart"]; "/etc/ferm/conf.d/defs.conf": - source => "puppet:///ferm/defs.conf", + content => template("ferm/defs.conf.erb"), require => Package["ferm"], mode => 0400, notify => Exec["ferm restart"]; diff --git a/modules/ferm/templates/defs.conf.erb b/modules/ferm/templates/defs.conf.erb new file mode 100644 index 00000000..82ca5f5b --- /dev/null +++ b/modules/ferm/templates/defs.conf.erb @@ -0,0 +1,57 @@ +## +## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. +## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git +## + +@def &SERVICE($proto, $port) = { + proto $proto mod state state (NEW) dport $port ACCEPT; +} + +@def &SERVICE_RANGE($proto, $port, $srange) = { + proto $proto mod state state (NEW) dport $port saddr ($srange) ACCEPT; +} + +@def &TCP_UDP_SERVICE($port) = { + proto (tcp udp) mod state state (NEW) dport $port ACCEPT; +} + +@def $HOST_NAGIOS = (<%= + nagii = [] + localinfo.keys.sort.each do |node| + if localinfo[node]['nagiosmaster'] == "true" + nagii << keyinfo[node][0]['ipHostNumber'] + end + end + + nagii.join(' ') +%>); + +@def $HOST_MUNIN = (<%= + munins = [] + localinfo.keys.sort.each do |node| + if localinfo[node]['muninmaster'] == "true" + munins << keyinfo[node][0]['ipHostNumber'] + end + end + + munins.join(' ') +%>); + +@def $sgran = (91.103.132.24/29); +@def $weasel = (); +@def $weasel = ($weasel 86.59.118.144/28); # debian@sil +@def $weasel = ($weasel 86.59.21.32/29); # anguilla1 +@def $weasel = ($weasel 86.59.30.32/28); # anguilla2 +@def $weasel = ($weasel 141.201.27.0/24); # came +@def $weasel = ($weasel 62.99.152.178); # argos.campus-sbg +@def $zobel = (); +@def $luca = (); +@def $DSA_IPS = ($sgran $weasel $zobel $luca); + +@def $sgran6 = (2001:4b10:100b::/48); +@def $weasel6 = (); +@def $weasel6 = ($weasel6 2001:826:408:200::/56); # came +@def $weasel6 = ($weasel6 2001:858:10f::/48); # anguilla +@def $zobel6 = (); +@def $luca6 = (); +@def $DSA_V6_IPS = ($sgran6 $weasel6 $zobel6 $luca6); diff --git a/modules/nagios/templates/inc-debian.org.erb b/modules/nagios/templates/inc-debian.org.erb index c53e7389..70f37b0b 100644 --- a/modules/nagios/templates/inc-debian.org.erb +++ b/modules/nagios/templates/inc-debian.org.erb @@ -4,7 +4,14 @@ ## <%= -nagii = [ '206.12.19.118', '192.25.206.33', '82.195.75.106' ] +ournag = [] +localinfo.keys.sort.each do |node| + if localinfo[node]['nagiosmaster'] == "true" + ournag << keyinfo[node][0]['ipHostNumber'] + end +end + +nagii = ournag case fqdn when 'mundy.debian.org', 'penalosa.debian.org', 'caballero.debian.org', 'peri.debian.org' then diff --git a/modules/samhain/templates/samhainrc.erb b/modules/samhain/templates/samhainrc.erb index e4afdac4..0ed6a865 100644 --- a/modules/samhain/templates/samhainrc.erb +++ b/modules/samhain/templates/samhainrc.erb @@ -134,13 +134,13 @@ file=/etc/nagios/nrpe.d file=/etc/nagios/obsolete-packages-ignore.d file=/etc/bind/geodns <%= extradir="" -case fqdn -when "tchaikovsky.debian.org": extradir="file=/etc/nagios3/puppetconf.d +if nodeinfo['nagiosmaster'] + extradir="file=/etc/nagios3/puppetconf.d file=/etc/puppet" -else extradir="file=/etc/puppet" end extradir %> +file=/etc/puppet file=/etc/cron.d file=/usr/lib/nagios/plugins file=/usr/sbin