And clean out mptraid things if we do not have mptraid
[mirror/dsa-puppet.git] / modules / hardware / manifests / raid / raidmpt.pp
1 # = Class: hardware::raid::raidmpt
2 #
3 # This class installs mpt-status and ensures the daemon is not running
4 #
5 # == Sample Usage:
6 #
7 #   include hardware::raid::raidmpt
8 #
9 class hardware::raid::raidmpt {
10         if $::mptraid {
11                 package { 'mpt-status':
12                         ensure => installed
13                 }
14
15                 file { '/etc/default/mpt-statusd':
16                         content => "# This file is under puppet control\nRUN_DAEMON=no\n",
17                         notify  => Exec['mpt-statusd-stop'],
18                 }
19
20                 exec { 'mpt-statusd-stop':
21                         command => 'pidfile=/var/run/mpt-statusd.pid; ! [ -e "$pidfile" ] || /sbin/start-stop-daemon --oknodo --stop --signal TERM --quiet --pidfile "$pidfile"; rm -f "$pidfile";  pkill -INT  -P 1 -u 0 -f "/usr/bin/daemon /etc/init.d/mpt-statusd check_mpt"',
22                         refreshonly => true,
23                 }
24         } else {
25                 package { 'mpt-status':
26                         ensure => purged,
27                 }
28
29                 file { '/etc/default/mpt-statusd':
30                         ensure => absent,
31                 }
32         }
33 }