diff --git a/munin/manifests/init.pp b/munin/manifests/init.pp index 472ccf2..ae06c5b 100644 --- a/munin/manifests/init.pp +++ b/munin/manifests/init.pp @@ -13,11 +13,24 @@ class munin::node { require => Package["munin-node"], } + case $operatingsystem { + OpenBSD: { + Service["munin-node"] { + name => "munin-node", + binary => "/usr/local/sbin/munin-node", + start => "/usr/local/sbin/munin-node", + } + } + } + file { "/etc/munin/munin-node.conf": ensure => present, content => template("munin/munin-node.conf.erb"), owner => root, - group => root, + group => $operatingsystem ? { + OpenBSD => wheel, + default => root, + }, mode => 0644, require => Package["munin-node"], notify => Service["munin-node"], @@ -62,13 +75,27 @@ class munin::node { # define munin::plugin($config = "") { - file { "/usr/share/munin/plugins/${name}": - ensure => present, - source => "puppet:///munin/plugins/${name}", - owner => root, - group => root, - mode => 0755, - require => Package["munin-node"], + case $operatingsystem { + OpenBSD: { + file { "/usr/local/lib/munin/plugins/${name}": + ensure => present, + source => "puppet:///munin/plugins/${name}", + owner => root, + group => wheel, + mode => 0755, + require => Package["munin-node"], + } + } + default: { + file { "/usr/share/munin/plugins/${name}": + ensure => present, + source => "puppet:///munin/plugins/${name}", + owner => root, + group => root, + mode => 0755, + require => Package["munin-node"], + } + } } if ($config) { @@ -78,21 +105,42 @@ define munin::plugin($config = "") { "puppet:///files/munin/plugin-conf/${config}", "puppet:///munin/plugin-conf/${config}", ], owner => root, - group => root, + group => $operatingsystem ? { + OpenBSD => wheel, + default => root, + }, mode => 0644, notify => Service["munin-node"], - require => File["/usr/share/munin/plugins/${name}"], + require => $operatingsystem ? { + OpenBSD => File["/usr/local/lib/munin/plugins/${name}"], + default => File["/usr/share/munin/plugins/${name}"], + }, } } - exec { "munin-enable-${name}": - command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}", - path => "/bin:/usr/bin:/sbin:/usr/sbin", - user => root, - onlyif => [ "! test -h /etc/munin/plugins/${name}", - "/usr/share/munin/plugins/${name} autoconf", ], - notify => Service["munin-node"], - require => File["/usr/share/munin/plugins/${name}"], + case $operatingsystem { + OpenBSD: { + exec { "munin-enable-${name}": + command => "ln -s /usr/local/lib/munin/plugins/${name} /etc/munin/plugins/${name}", + path => "/bin:/usr/bin:/sbin:/usr/sbin", + user => root, + onlyif => [ "test ! -h /etc/munin/plugins/${name}", + "/usr/local/lib/munin/plugins/${name} autoconf", ], + notify => Service["munin-node"], + require => File["/usr/local/lib/munin/plugins/${name}"], + } + } + default: { + exec { "munin-enable-${name}": + command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}", + path => "/bin:/usr/bin:/sbin:/usr/sbin", + user => root, + onlyif => [ "test ! -h /etc/munin/plugins/${name}", + "/usr/share/munin/plugins/${name} autoconf", ], + notify => Service["munin-node"], + require => File["/usr/share/munin/plugins/${name}"], + } + } } } diff --git a/munin/templates/munin-node.conf.erb b/munin/templates/munin-node.conf.erb index 4c21e2e..0c44d99 100644 --- a/munin/templates/munin-node.conf.erb +++ b/munin/templates/munin-node.conf.erb @@ -10,7 +10,11 @@ background 1 setseid 1 user root +<% if operatingsystem == "OpenBSD" -%> +group wheel +<% else -%> group root +<% end -%> setsid yes # Regexps for files to ignore