diff options
-rw-r--r-- | manifests/init.pp | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 328e71d..9353941 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,7 +24,12 @@ class nodo { include motd include utils include cron - include munin::client + + # We include munin configuration if it's not defined by + # and exported resource. + if !defined(nodo::vserver::Munin[$hostname]) { + include munin::client + } # Set timezone and ntp config # @@ -182,21 +187,16 @@ class nodo::vserver inherits nodo { define munin($type, $id) { # Use one port for each node - $munin_port = "49$id" - case $type { - 'host': { - include munin::host - include munin::client - } - 'client': { - include munin::client - } - } + $munin_port = "59$id" + include munin::client } + # Apply munin configuration for this node + nodo::vserver::Munin <| tag == $name |> + # Define a vserver instance define instance($context, $ensure = 'running', $proxy = false, $puppetmaster = false, $gitd = false, - $munin = 'client', $icecast = false, $sound = false, $ticket = false) { + $icecast = false, $sound = false, $ticket = false) { # set instance id if $context < 9 { @@ -226,6 +226,12 @@ class nodo::vserver inherits nodo { require => Exec["vs_create_${name}"], } + # Create a munin virtual resource to be realized in the node + @nodo::vserver::munin { + id => $id, + tag => $name, + } + # Sound support if $sound { if !defined(File["/usr/local/sbin/create-sound-devices"]) { @@ -266,7 +272,17 @@ class nodo::vserver inherits nodo { destinationport => '8140', originaldest => "$ipaddress", ratelimit => '-', - order => '304', + order => "3$id", + } + + shorewall::rule { "munin-$context": + action => 'DNAT', + source => 'net', + destination => "vm:192.168.0.$context:59$id", + proto => 'tcp', + destinationport => "59$id", + ratelimit => '-', + order => "4$id", } if $proxy { @@ -277,7 +293,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '80', ratelimit => '-', - order => '300', + order => '500', } shorewall::rule { 'https-route': @@ -287,7 +303,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '443', ratelimit => '-', - order => '301', + order => '501', } } @@ -299,7 +315,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '8140', ratelimit => '-', - order => '302', + order => '502', } shorewall::rule { 'puppetmaster-2': @@ -309,7 +325,7 @@ class nodo::vserver inherits nodo { proto => 'udp', destinationport => '8140', ratelimit => '-', - order => '303', + order => '503', } shorewall::rule { 'puppetmaster-3': @@ -320,7 +336,7 @@ class nodo::vserver inherits nodo { destinationport => '8140', originaldest => "$ipaddress", ratelimit => '-', - order => '304', + order => '504', } shorewall::rule { 'puppetmaster-4': @@ -331,7 +347,7 @@ class nodo::vserver inherits nodo { destinationport => '8140', originaldest => "$ipaddress", ratelimit => '-', - order => '305', + order => '505', } } @@ -343,7 +359,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '9418', ratelimit => '-', - order => '306', + order => '506', } shorewall::rule { 'git-daemon-2': @@ -353,7 +369,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '9418', ratelimit => '-', - order => '307', + order => '507', } } @@ -365,7 +381,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '8000', ratelimit => '-', - order => '308', + order => '508', } shorewall::rule { 'icecast-2': @@ -375,7 +391,7 @@ class nodo::vserver inherits nodo { proto => 'tcp', destinationport => '8000', ratelimit => '-', - order => '309', + order => '509', } } } |