diff --git a/cups/manifests/init.pp b/cups/manifests/init.pp index b6f9df4..23bdebd 100644 --- a/cups/manifests/init.pp +++ b/cups/manifests/init.pp @@ -13,8 +13,8 @@ class cups::client { mode => "0644", owner => root, group => $::operatingsystem ? { - openbsd => wheel, - default => lp, + "openbsd" => "wheel", + default => "lp", }, require => Package["cups"], } @@ -22,10 +22,7 @@ class cups::client { case $::operatingsystem { "openbsd": { exec { "cups-enable": - command => $::operatingsystemrelease ? { - /4\.[1-8]/ => "echo y | cups-enable", - default => "sh -c '. /etc/rc.d/cupsd check ; rc_pre'", - }, + command => "sh -c '. /etc/rc.d/cupsd check ; rc_pre'", path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", user => "root", creates => "/usr/bin/lpr.pre-cups", diff --git a/custom/lib/puppet/provider/service/openbsd.rb b/custom/lib/puppet/provider/service/openbsd.rb index f5c18fe..c9d0803 100644 --- a/custom/lib/puppet/provider/service/openbsd.rb +++ b/custom/lib/puppet/provider/service/openbsd.rb @@ -4,9 +4,7 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :base do desc "OpenBSD service management." - version = ["4.9", "5.0", "5.1", "5.2", "5.3"] confine :operatingsystem => :openbsd - confine :operatingsystemrelease => version defaultfor :operatingsystem => :openbsd def rc_dir() '/etc/rc.d' end diff --git a/custom/lib/puppet/provider/service/openbsd_old.rb b/custom/lib/puppet/provider/service/openbsd_old.rb deleted file mode 100644 index e2051cc..0000000 --- a/custom/lib/puppet/provider/service/openbsd_old.rb +++ /dev/null @@ -1,128 +0,0 @@ -# Manage OpenBSD services. Enable/disable using /etc/rc.local, /etc/rc.conf.local - -Puppet::Type.type(:service).provide :openbsd_old, :parent => :base do - - desc "OpenBSD service management." - - version = ["4.1", "4.2", "4.3", "4.4", "4.5", "4.6", "4.7", "4.8"] - confine :operatingsystem => :openbsd - confine :operatingsystemrelease => version - defaultfor :operatingsystem => :openbsd - - def rclocal() '/etc/rc.local' end - def rcconf() '/etc/rc.conf' end - def rcconflocal() '/etc/rc.conf.local' end - - def getrcconf - File.readlines(rcconf).each { |line| - if line =~ /^#{@resource[:name]}_flags=.*/ - return "#{@resource[:name]}_flags" - elsif line =~ /^#{@resource[:name]}=.*/ - return @resource[:name] - end - } - return false - end - - def enabled? - if not defined? @resource[:start] - raise Puppet::Error, - "Services must specify a start command or a binary" - end - flag = getrcconf() - if flag - File.readlines(rcconflocal).each { |line| - line = line.strip.split(/=/, 2) - next unless line[0] == flag - if line[1] == "NO" - return :false - end - return :true - } - return :false - else - inlocal = false - File.readlines(rclocal).each { |line| - line = line.strip - if not inlocal - next unless \ - line == "# Add your local startup actions here." - inlocal = true - else - if line == "echo '.'" - inlocal = false - break - end - next unless line =~ /^echo -n \" #{@resource[:name]}\" ; .*/ - return :true - end - } - return :false - end - end - - def enable - flag = getrcconf() - if flag - newdata = "" - File.readlines(rcconflocal).each { |line| - if line.strip.split(/=/, 2)[0] == flag - next - else - newdata += line - end - } - if flag == @resource[:name] - newdata += "%s=YES\n" % flag - elsif flag == "#{@resource[:name]}_flags" - if @resource[:start] != nil and @resource[:binary] != nil - args = @resource[:start][/^#{@resource[:binary]} (.*)/, 1] - end - newdata += "%s=\"%s\"\n" % [flag, args] - end - f = File.open(rcconflocal, "w") - f.write(newdata) - f.close - else - newdata = "" - inlocal = false - File.readlines(rclocal).each { |line| - if line == "# Add your local startup actions here.\n" - newdata += line - newdata += "echo -n \" %s\" ; %s\n" % [@resource[:name], - @resource[:start]] - next - end - newdata += line - } - f = File.open(rclocal, "w") - f.write(newdata) - f.close - end - return :true - end - - def disable - flag = getrcconf() - if flag - newdata = "" - File.readlines(rcconflocal).each { |line| - if line.strip.split(/=/, 2)[0] == flag - next - else - newdata += line - end - } - if flag == @resource[:name] or flag == "#{@resource[:name]}_flags" - newdata += "%s=NO\n" % flag - end - f = File.open(rcconflocal, "w") - f.write(newdata) - f.close - else - print "disabling services from rc.local not implemented\n" - end - return :true - end - -end diff --git a/dhcp/manifests/init.pp b/dhcp/manifests/init.pp index bee5cc8..1fed296 100644 --- a/dhcp/manifests/init.pp +++ b/dhcp/manifests/init.pp @@ -27,38 +27,38 @@ class dhcp::server::common { package { "dhcp": name => $::operatingsystem ? { - Debian => "dhcp3-server", - OpenBSD => "isc-dhcp-server", - Ubuntu => "dhcp3-server", - default => "dhcp", + "debian" => "dhcp3-server", + "ubuntu" => "dhcp3-server", + "openbsd" => "isc-dhcp-server", + default => "dhcp", }, ensure => installed, } file { "dhcpd.leases": name => $::operatingsystem ? { - Debian => "/var/lib/dhcp3/dhcpd.leases", - OpenBSD => "/var/db/dhcpd.leases", - Ubuntu => "/var/lib/dhcp3/dhcpd.leases", - default => "/var/lib/dhcpd/dhcpd.leases", + "debian" => "/var/lib/dhcp3/dhcpd.leases", + "ubuntu" => "/var/lib/dhcp3/dhcpd.leases", + "openbsd" => "/var/db/dhcpd.leases", + default => "/var/lib/dhcpd/dhcpd.leases", }, ensure => present, owner => $::operatingsystem ? { - debian => dhcpd, - ubuntu => dhcpd, - default => root, + "debian" => "dhcpd", + "ubuntu" => "dhcpd", + default => "root", }, group => $::operatingsystem ? { - Debian => dhcpd, - OpenBSD => wheel, - Ubuntu => dhcpd, - default => root, + "debian" => "dhcpd", + "ubuntu" => "dhcpd", + "openbsd" => "wheel", + default => "root", }, require => Package["dhcp"], before => Service["dhcpd"], } - if $::operatingsystem == "OpenBSD" and $::operatingsystemrelease !~ /4\.[1-8]/ { + if $::operatingsystem == "OpenBSD" { file { "/etc/rc.d/isc_dhcpd": ensure => present, mode => "0555", @@ -71,26 +71,23 @@ class dhcp::server::common { service { "dhcpd": name => $::operatingsystem ? { - Debian => "dhcp3-server", - OpenBSD => $::operatingsystemrelease ? { - /4\.[1-8]/ => "isc-dhcpd", - default => "isc_dhcpd", - }, - Ubuntu => "dhcp3-server", - default => "dhcpd", + "debian" => "dhcp3-server", + "ubuntu" => "dhcp3-server", + "openbsd" => "isc_dhcpd", + default => "dhcpd", }, ensure => running, enable => true, binary => $::operatingsystem ? { - OpenBSD => "/usr/local/sbin/dhcpd", - default => undef, + "openbsd" => "/usr/local/sbin/dhcpd", + default => undef, }, start => $::operatingsystem ? { - OpenBSD => $dhcp_server_interface ? { + "openbsd" => $dhcp_server_interface ? { "" => "/usr/local/sbin/dhcpd -q", default => "/usr/local/sbin/dhcpd -q ${dhcp_server_interface}", }, - default => undef, + default => undef, }, require => Package["dhcp"], } @@ -132,10 +129,10 @@ class dhcp::server inherits dhcp::server::common { source => [ "puppet:///files/dhcp/dhcpd.conf.${fqdn}", "puppet:///files/dhcp/dhcpd.conf", ], mode => "0644", - owner => root, + owner => "root", group => $::operatingsystem ? { - openbsd => wheel, - default => root, + "openbsd" => "wheel", + default => "root", }, notify => Service["dhcpd"], } @@ -159,10 +156,10 @@ class dhcp::server::ldap inherits dhcp::server::common { ensure => present, source => "puppet:///modules/dhcp/dhcpdump.py", mode => "0755", - owner => root, + owner => "root", group => $::operatingsystem ? { - OpenBSD => wheel, - default => root, + "openbsd" => "wheel", + default => "root", }, } @@ -172,10 +169,10 @@ class dhcp::server::ldap inherits dhcp::server::common { source => [ "puppet:///files/dhcp/dhcpd.conf.in.${hostname}", "puppet:///files/dhcp/dhcpd.conf.in", ], mode => "0644", - owner => root, + owner => "root", group => $::operatingsystem ? { - OpenBSD => wheel, - default => root, + "openbsd" => "wheel", + default => "root", }, require => Package["dhcp"], } @@ -211,18 +208,18 @@ class dhcp::server::ldap inherits dhcp::server::common { # dhcp::relay { "relay0": interface => "em2", server_addr => "10.20.110.11" } # -define dhcp::relay ($interface, $server_addr) { +define dhcp::relay($interface, $server_addr) { + service { $name: - name => $name, ensure => running, provider => "base", hasrestart => false, hasstatus => false, pattern => "/usr/sbin/dhcrelay -i ${interface} ${server_addr}", start => $::operatingsystem ? { - OpenBSD => "/usr/sbin/dhcrelay -i ${interface} ${server_addr}", - default => undef, + "openbsd" => "/usr/sbin/dhcrelay -i ${interface} ${server_addr}", + default => undef, } } -} +} diff --git a/munin/manifests/init.pp b/munin/manifests/init.pp index 431ae5b..57b478b 100644 --- a/munin/manifests/init.pp +++ b/munin/manifests/init.pp @@ -9,26 +9,12 @@ class munin::node { service { "munin-node": name => $::operatingsystem ? { - OpenBSD => $::operatingsystemrelease ? { - /4\.[1-8]/ => "munin-node", - default => "munin_node", - }, - default => "munin-node", + "openbsd" => "munin_node", + default => "munin-node", }, ensure => running, enable => true, require => Package["munin-node"], - start => $::operatingsystem ? { - OpenBSD => $::operatingsystemrelease ? { - /4\.[1-8]/ => "/usr/bin/install -d -o _munin /var/run/munin; /usr/local/sbin/munin-node", - default => undef, - }, - default => undef, - }, - stop => $::operatingsystem ? { - OpenBSD => "/usr/bin/pkill -f /usr/local/sbin/munin-node", - default => undef, - }, } file { "/etc/munin/munin-node.conf": @@ -56,7 +42,7 @@ class munin::node { exec { "munin-node-configure": command => "munin-node-configure --shell --remove-also 2>/dev/null | /bin/sh", path => "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin", - user => root, + user => "root", refreshonly => true, notify => Service["munin-node"], } @@ -99,10 +85,10 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") { file { "/etc/munin/plugin-conf.d/snmp_${name}": ensure => present, content => "[snmp_${name}_*]\nenv.community ${snmp_community}\nenv.version ${snmp_version}\n", - owner => root, + owner => "root", group => $::operatingsystem ? { - OpenBSD => wheel, - default => root, + "openbsd" => "wheel", + default => "root", }, mode => "0600", notify => Service["munin-node"], @@ -165,14 +151,14 @@ define munin::plugin($config = "") { "puppet:///modules/munin/plugin-conf/${config}", ], owner => "root", group => $::operatingsystem ? { - OpenBSD => wheel, - default => root, + "openbsd" => "wheel", + default => "root", }, mode => "0644", notify => Service["munin-node"], require => $::operatingsystem ? { - OpenBSD => File["/usr/local/libexec/munin/plugins/${name}"], - default => File["/usr/share/munin/plugins/${name}"], + "openbsd" => File["/usr/local/libexec/munin/plugins/${name}"], + default => File["/usr/share/munin/plugins/${name}"], }, } } @@ -182,7 +168,7 @@ define munin::plugin($config = "") { exec { "munin-enable-${name}": command => "ln -s /usr/local/libexec/munin/plugins/${name} /etc/munin/plugins/${name}", path => "/bin:/usr/bin:/sbin:/usr/sbin", - user => root, + user => "root", onlyif => [ "test ! -h /etc/munin/plugins/${name}", "/usr/local/libexec/munin/plugins/${name} autoconf", ], notify => Service["munin-node"], @@ -193,7 +179,7 @@ define munin::plugin($config = "") { 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, + user => "root", onlyif => [ "test ! -h /etc/munin/plugins/${name}", "/usr/share/munin/plugins/${name} autoconf", ], notify => Service["munin-node"], diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp index af02563..e7f3ec3 100644 --- a/puppet/manifests/init.pp +++ b/puppet/manifests/init.pp @@ -70,20 +70,9 @@ class puppet::client { case $::operatingsystem { "openbsd": { service { "puppet": - name => $::operatingsystemrelease ? { - /4\.[1-8]/ => "puppet", - default => "puppetd", - }, + name => "puppetd", ensure => running, enable => true, - start => $::operatingsystemrelease ? { - /^4\./ => "/usr/local/sbin/puppetd", - default => undef, - }, - stop => $::operatingsystemrelease ? { - /^4\./ => "pkill -f /usr/local/sbin/puppetd", - default => undef, - }, status => $::puppetversion ? { /^[0-2]\./ => "pgrep -f /usr/local/sbin/puppetd", default => "pgrep -f /usr/local/bin/puppet", diff --git a/syslog/manifests/init.pp b/syslog/manifests/init.pp index 6df6466..846a3d0 100644 --- a/syslog/manifests/init.pp +++ b/syslog/manifests/init.pp @@ -177,13 +177,6 @@ class syslog::client::rsyslog { service { "rsyslog": ensure => running, enable => true, - start => $::operatingsystem ? { - "openbsd" => $::operatingsystemrelease ? { - /4\.[1-8]/ => "pkill syslogd; /usr/local/sbin/rsyslogd -c 4 -x -i /var/run/syslog.pid", - default => undef, - }, - default => undef, - }, hasrestart => $::operatingsystem ? { "fedora" => true, default => false, @@ -191,7 +184,7 @@ class syslog::client::rsyslog { require => File["/var/log/all.log"], } - if $::operatingsystem == "OpenBSD" and $::operatingsystemrelease !~ /4\.[1-8]/ { + if $::operatingsystem == "OpenBSD" { file { "/etc/rc.d/syslogd": ensure => present, mode => "0555",