We don't want to erase existing ARRAY configs. Using augeas would be better, but it didn't work on this file on CentOS 5.
119 lines
2.7 KiB
Puppet
119 lines
2.7 KiB
Puppet
# Install tools for detected raid controllers.
|
|
#
|
|
class raid::tools {
|
|
|
|
if $::raid {
|
|
$controllers = split($::raid, ',')
|
|
|
|
if "smartarray" in $controllers {
|
|
include raid::tools::hpacucli
|
|
}
|
|
if "linux-md" in $controllers {
|
|
include raid::tools::mdadm
|
|
}
|
|
if "megaraid" in $controllers {
|
|
include raid::tools::megacli
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install HP SmartArray tools.
|
|
#
|
|
class raid::tools::hpacucli {
|
|
|
|
case $::operatingsystem {
|
|
"centos","redhat": {
|
|
include yum::repo::hpspp
|
|
package { "hpacucli":
|
|
ensure => installed,
|
|
require => Yum::Repo["hpspp"],
|
|
}
|
|
}
|
|
default: {
|
|
fail("raid::tools::smartarray not supported in ${::operatingsystem}")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install Linux software raid tools (mdadm).
|
|
#
|
|
class raid::tools::mdadm {
|
|
|
|
if $::kernel != "Linux" {
|
|
fail("raid::tools::mdadm not supported in ${::operatingsystem}")
|
|
}
|
|
|
|
package { "mdadm":
|
|
ensure => installed,
|
|
}
|
|
|
|
case $::operatingsystem {
|
|
"centos", "fedora": {
|
|
file { "/etc/mdadm.conf":
|
|
ensure => present,
|
|
replace => false,
|
|
content => "MAILADDR root\n",
|
|
mode => "0644",
|
|
owner => "root",
|
|
group => "root",
|
|
require => Package["mdadm"],
|
|
notify => Service["mdadm"],
|
|
}
|
|
}
|
|
default: { }
|
|
}
|
|
|
|
service { "mdadm":
|
|
ensure => running,
|
|
name => $::operatingsystem ? {
|
|
"centos" => "mdmonitor",
|
|
"fedora" => "mdmonitor",
|
|
default => "mdadm",
|
|
},
|
|
enable => true,
|
|
hasstatus => true,
|
|
require => Package["mdadm"],
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install MegaCli.
|
|
#
|
|
# Download MegaCli RPM from:
|
|
# http://www.lsi.com/support/Pages/Download-Results.aspx?keyword=MegaCli
|
|
#
|
|
# === Global variables
|
|
#
|
|
# $raid_megacli_package:
|
|
# Name of MegaCli package.
|
|
#
|
|
class raid::tools::megacli {
|
|
|
|
if ! $raid_megacli_package {
|
|
fail("Must define \$raid_megacli_package")
|
|
}
|
|
|
|
if ! ($::operatingsystem in ["CentOS", "RedHat"]) {
|
|
fail("raid::tools::megacli not supported in ${::operatingsystem}")
|
|
}
|
|
|
|
file { "/usr/local/src/${raid_megacli_package}":
|
|
ensure => present,
|
|
mode => "0644",
|
|
owner => "root",
|
|
group => "root",
|
|
source => "puppet:///files/packages/${raid_megacli_package}",
|
|
before => Package["MegaCli"],
|
|
}
|
|
package { "MegaCli":
|
|
ensure => latest,
|
|
provider => "rpm",
|
|
source => "/usr/local/src/${raid_megacli_package}",
|
|
}
|
|
|
|
}
|