From aaf55c9ebfa0e34f63b2ca3c2b660e1d164026dd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 18:13:12 +0200 Subject: lintify --- manifests/client/base.pp | 26 ++++++++++++++++---------- manifests/client/centos.pp | 1 + manifests/client/darwin.pp | 29 +++++++++++++++-------------- manifests/client/debian.pp | 9 +++++---- manifests/client/gentoo.pp | 3 ++- manifests/client/openbsd.pp | 2 +- manifests/client/package.pp | 1 + 7 files changed, 41 insertions(+), 30 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 78398a9..3c0ba89 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,24 +1,30 @@ +# Install a basic munin client class munin::client::base { service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, + ensure => running, + enable => true, + hasstatus => true, hasrestart => true, } file {'/etc/munin': ensure => directory, - mode => 0755, owner => root, group => 0; + mode => '0755', + owner => root, + group => 0, } file {'/etc/munin/munin-node.conf': content => template("munin/munin-node.conf.${::operatingsystem}"), - notify => Service['munin-node'], - mode => 0644, owner => root, group => 0, + notify => Service['munin-node'], + mode => '0644', + owner => root, + group => 0, + } + $host = $munin::client::host ? { + '*' => $::fqdn, + default => $munin::client::host } munin::register { $::fqdn: - host => $munin::client::host ? { - '*' => $::fqdn, - default => $munin::client::host - }, + host => $host, port => $munin::client::port, use_ssh => $munin::client::use_ssh, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp index 3a7151b..cd4f2f6 100644 --- a/manifests/client/centos.pp +++ b/manifests/client/centos.pp @@ -1,3 +1,4 @@ +# Install a munin client on centos class munin::client::centos inherits munin::client::package { include munin::plugins::centos } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 264263d..7639896 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,22 @@ +# Install a munin client on darwin class munin::client::darwin { - file { "/usr/share/snmp/snmpd.conf": - mode => 744, - content => template("munin/darwin_snmpd.conf.erb"), - group => 0, - owner => root, + file { '/usr/share/snmp/snmpd.conf': + mode => '0744', + content => template('munin/darwin_snmpd.conf.erb'), + group => 0, + owner => root, } - line{"startsnmpdno": - file => "/etc/hostconfig", - line => "SNMPSERVER=-NO-", - ensure => 'absent', + line{'startsnmpdno': + ensure => absent, + file => '/etc/hostconfig', + line => 'SNMPSERVER=-NO-', } - line { "startsnmpdyes": - file => "/etc/hostconfig", - line => "SNMPSERVER=-YES-", - notify => Exec["/sbin/SystemStarter start SNMP"], + line { 'startsnmpdyes': + file => '/etc/hostconfig', + line => 'SNMPSERVER=-YES-', + notify => Exec['/sbin/SystemStarter start SNMP'], } - exec{"/sbin/SystemStarter start SNMP": + exec{'/sbin/SystemStarter start SNMP': noop => false, } munin::register::snmp { $::fqdn: } diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index e67ac26..3cfc3fc 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,15 +1,16 @@ +# Install the munin client on debian class munin::client::debian inherits munin::client::package { # the plugin will need that - package { "iproute": ensure => installed } + package { 'iproute': ensure => installed } - Service["munin-node"]{ + Service['munin-node']{ # sarge's munin-node init script has no status hasstatus => $::lsbdistcodename ? { sarge => false, default => true } } - File["/etc/munin/munin-node.conf"]{ + File['/etc/munin/munin-node.conf']{ content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), } # workaround bug in munin_node_configure - plugin { "postfix_mailvolume": ensure => absent } + plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian } diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index e79f6b0..186950b 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,7 +1,8 @@ +# install a munin client on gentoo class munin::client::gentoo inherits munin::client::package { Package['munin-node'] { - name => 'munin', + name => 'munin', category => 'net-analyzer', } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index cd21abf..e3c18d5 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -4,7 +4,7 @@ class munin::client::openbsd inherits munin::client::base { if $::operatingsystemrelease == '4.3' { file{'/usr/src/munin_openbsd.tar.gz': - source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz", + source => 'puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz', owner => root, group => 0, mode => '0600'; diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 206ccc8..0958202 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,3 +1,4 @@ +# Install a munin client using packages class munin::client::package inherits munin::client::base { package { 'munin-node': ensure => installed } Service['munin-node']{ -- cgit v1.2.3 From d2a2cb77b9a9ca5deddecdec3d14ac763388929e Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:46:46 +0100 Subject: cleanup openbsd manual installation + remove unnecessary files The manual OpenBSD installation is now so old and not needed anymore. --- manifests/client/base.pp | 15 +++++++++++---- manifests/client/centos.pp | 4 ---- manifests/client/debian.pp | 13 ++++++++++--- manifests/client/gentoo.pp | 2 +- manifests/client/openbsd.pp | 40 +++------------------------------------- manifests/client/package.pp | 13 ------------- 6 files changed, 25 insertions(+), 62 deletions(-) delete mode 100644 manifests/client/centos.pp delete mode 100644 manifests/client/package.pp (limited to 'manifests/client') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 3c0ba89..e81028d 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,10 +1,14 @@ # Install a basic munin client class munin::client::base { + package { 'munin-node': + ensure => installed + } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -14,6 +18,9 @@ class munin::client::base { } file {'/etc/munin/munin-node.conf': content => template("munin/munin-node.conf.${::operatingsystem}"), + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package['munin-node'], notify => Service['munin-node'], mode => '0644', owner => root, diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp deleted file mode 100644 index cd4f2f6..0000000 --- a/manifests/client/centos.pp +++ /dev/null @@ -1,4 +0,0 @@ -# Install a munin client on centos -class munin::client::centos inherits munin::client::package { - include munin::plugins::centos -} diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 3cfc3fc..f94356a 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,11 +1,18 @@ # Install the munin client on debian -class munin::client::debian inherits munin::client::package { +class munin::client::debian inherits munin::client::base { # the plugin will need that - package { 'iproute': ensure => installed } + package { 'iproute': + ensure => installed + } + + $hasstatus = $::lsbdistcodename ? { + sarge => false, + default => true + } Service['munin-node']{ # sarge's munin-node init script has no status - hasstatus => $::lsbdistcodename ? { sarge => false, default => true } + hasstatus => $hasstatus } File['/etc/munin/munin-node.conf']{ content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 186950b..fde592f 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,5 +1,5 @@ # install a munin client on gentoo -class munin::client::gentoo inherits munin::client::package { +class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { name => 'munin', diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index e3c18d5..5ced4c4 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,53 +1,19 @@ -# currently we install munin on openbsd by targz -# :( - +# generate a few missing things on openbsd class munin::client::openbsd inherits munin::client::base { - if $::operatingsystemrelease == '4.3' { - file{'/usr/src/munin_openbsd.tar.gz': - source => 'puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz', - owner => root, - group => 0, - mode => '0600'; - } - exec{'extract_openbsd': - command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz', - unless => 'test -d /opt/munin', - require => File['/usr/src/munin_openbsd.tar.gz'], - before => File['/var/run/munin'], - } - package{'p5-Compress-Zlib': - ensure => installed, - before => File['/var/run/munin'], - } - } else { - package{'munin-node': - ensure => installed, - } - } - package{ [ 'p5-Crypt-SSLeay', 'p5-HTML-Parser', 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', - 'p5-LWP-UserAgent-Determined', 'p5-Net-SSLeay', 'p5-Net-Server', - 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]: - ensure => installed, - before => File['/var/run/munin'], - } file{[ '/var/run/munin', '/var/log/munin' ]: ensure => directory, owner => root, group => 0, mode => '0755'; } - $bin_loc = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/sbin/munin-node', - default => '/usr/local/sbin/munin-node' - } openbsd::rc_local{'munin-node': - binary => $bin_loc, + binary => '/usr/local/sbin/munin-node', require => File['/var/run/munin'], } Service['munin-node']{ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`', stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`', - start => $bin_loc, + start => '/usr/local/sbin/munin-node', status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")', hasstatus => true, hasrestart => true, diff --git a/manifests/client/package.pp b/manifests/client/package.pp deleted file mode 100644 index 0958202..0000000 --- a/manifests/client/package.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Install a munin client using packages -class munin::client::package inherits munin::client::base { - package { 'munin-node': ensure => installed } - Service['munin-node']{ - require => Package[munin-node], - } - File['/etc/munin/munin-node.conf']{ - # this has to be installed before the package, so the postinst can - # boot the munin-node without failure! - before => Package['munin-node'], - } -} - -- cgit v1.2.3 From 161e5cb4722ec22dff7f367fcf5460364e598497 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Mon, 18 Nov 2013 22:27:46 +0100 Subject: use rather ensure_packages --- manifests/client/debian.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f94356a..63a0e14 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,9 +1,7 @@ # Install the munin client on debian class munin::client::debian inherits munin::client::base { # the plugin will need that - package { 'iproute': - ensure => installed - } + ensure_packages(['iproute']) $hasstatus = $::lsbdistcodename ? { sarge => false, -- cgit v1.2.3 From 057658ba93e2562c596dfa5607836679631be916 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 22:49:02 +0200 Subject: Unify OS specific munin-conf.conf In essence all munin-node.conf files contained the same template, besides a few values. By moving all to a single template, maintenance burden is reduced. To ensure all values are still present in the templates, tests are added. --- manifests/client/base.pp | 4 ++-- manifests/client/debian.pp | 3 --- manifests/client/params.pp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 manifests/client/params.pp (limited to 'manifests/client') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index e81028d..71531fa 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,5 +1,5 @@ # Install a basic munin client -class munin::client::base { +class munin::client::base inherits munin::client::params { package { 'munin-node': ensure => installed } @@ -17,7 +17,7 @@ class munin::client::base { group => 0, } file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.${::operatingsystem}"), + content => template("${module_name}/munin-node.conf.erb"), # this has to be installed before the package, so the postinst can # boot the munin-node without failure! before => Package['munin-node'], diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 63a0e14..f1bbb3c 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -12,9 +12,6 @@ class munin::client::debian inherits munin::client::base { # sarge's munin-node init script has no status hasstatus => $hasstatus } - File['/etc/munin/munin-node.conf']{ - content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), - } # workaround bug in munin_node_configure plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian diff --git a/manifests/client/params.pp b/manifests/client/params.pp new file mode 100644 index 0000000..14d3749 --- /dev/null +++ b/manifests/client/params.pp @@ -0,0 +1,19 @@ +# Set the parameters for the munin client +class munin::client::params { + $user = 'root' + + case $::operatingsystem { + 'OpenBSD': { + $group = '0' + $log_file = '/var/log/munin-node/munin-node.log' + } + 'Debian': { + $group = 'root' + $log_file = '/var/log/munin/munin-node.log' + } + default: { + $group = 'root' + $log_file = '/var/log/munin-node/munin-node.log' + } + } +} -- cgit v1.2.3 From 99e32a12d401828e71c13309bf21460086f77e0e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:32:52 +0100 Subject: unify logdir --- manifests/client/openbsd.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 5ced4c4..64ea588 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,6 +1,6 @@ # generate a few missing things on openbsd class munin::client::openbsd inherits munin::client::base { - file{[ '/var/run/munin', '/var/log/munin' ]: + file{[ '/var/run/munin', '/var/log/munin-node' ]: ensure => directory, owner => root, group => 0, @@ -17,10 +17,10 @@ class munin::client::openbsd inherits munin::client::base { status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")', hasstatus => true, hasrestart => true, - require => [ File['/var/run/munin'], File['/var/log/munin'] ], + require => [ File['/var/run/munin'], File['/var/log/munin-munin'] ], } cron{'clean_munin_logfile': - command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', + command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', minute => 0, hour => 2, weekday => 0, -- cgit v1.2.3 From 0ebbe54879941e886dc1519b7dfdc69f614975ad Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:37:11 +0100 Subject: correct dependency --- manifests/client/openbsd.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/client') diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 64ea588..09fb24f 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -17,7 +17,7 @@ class munin::client::openbsd inherits munin::client::base { status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")', hasstatus => true, hasrestart => true, - require => [ File['/var/run/munin'], File['/var/log/munin-munin'] ], + require => [ File['/var/run/munin'], File['/var/log/munin-node'] ], } cron{'clean_munin_logfile': command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', -- cgit v1.2.3 From 695d81c81cd152b5dd7333d0eae2bd6df108a41e Mon Sep 17 00:00:00 2001 From: Arjen Heidinga Date: Fri, 31 Jan 2014 09:52:10 +0100 Subject: Add support for setting the descryption and group support --- manifests/client/base.pp | 12 +++++++----- manifests/client/params.pp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 71531fa..d35d742 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -31,11 +31,13 @@ class munin::client::base inherits munin::client::params { default => $munin::client::host } munin::register { $::fqdn: - host => $host, - port => $munin::client::port, - use_ssh => $munin::client::use_ssh, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], - export_tag => $munin::client::export_tag, + host => $host, + port => $munin::client::port, + use_ssh => $munin::client::use_ssh, + description => $munin::client::description, + group => $munin::client::munin_group, + config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + export_tag => $munin::client::export_tag, } include munin::plugins::base } diff --git a/manifests/client/params.pp b/manifests/client/params.pp index 14d3749..4473912 100644 --- a/manifests/client/params.pp +++ b/manifests/client/params.pp @@ -2,7 +2,7 @@ class munin::client::params { $user = 'root' - case $::operatingsystem { + case $::osfamily { 'OpenBSD': { $group = '0' $log_file = '/var/log/munin-node/munin-node.log' -- cgit v1.2.3 From 3cf822dfee3e56e2461c2a5d96dca448c008cd34 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:08 +0200 Subject: Rename the package to avoid naming conflicts --- manifests/client/gentoo.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index fde592f..263fecd 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -2,8 +2,7 @@ class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { - name => 'munin', - category => 'net-analyzer', + name => 'net-analyzer/munin', } include munin::plugins::gentoo -- cgit v1.2.3 From 39eb7ac31ad7f1fc16c37c42823fb1860c1f09ba Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:12:27 +0200 Subject: get rid off lsb facts - who runs sarge? --- manifests/client/debian.pp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f1bbb3c..49ee567 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -3,15 +3,6 @@ class munin::client::debian inherits munin::client::base { # the plugin will need that ensure_packages(['iproute']) - $hasstatus = $::lsbdistcodename ? { - sarge => false, - default => true - } - - Service['munin-node']{ - # sarge's munin-node init script has no status - hasstatus => $hasstatus - } # workaround bug in munin_node_configure plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian -- cgit v1.2.3 From 27c9a5dbc2083dcc20d059008702dd3f75382bcc Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Oct 2014 11:54:10 +0200 Subject: more linting and latest puppet-lint support --- manifests/client/base.pp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'manifests/client') diff --git a/manifests/client/base.pp b/manifests/client/base.pp index d35d742..6ed0f71 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -4,11 +4,11 @@ class munin::client::base inherits munin::client::params { ensure => installed } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - require => Package[munin-node], + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -36,7 +36,8 @@ class munin::client::base inherits munin::client::params { use_ssh => $munin::client::use_ssh, description => $munin::client::description, group => $munin::client::munin_group, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + config => [ 'use_node_name yes', 'load.load.warning 5', + 'load.load.critical 10'], export_tag => $munin::client::export_tag, } include munin::plugins::base -- cgit v1.2.3