* Add a defined type to manage IPMI's user and channel.

This commit is contained in:
gardouille 2015-01-20 08:40:12 +01:00
parent 4eb0027c72
commit 22f665ad77
3 changed files with 36 additions and 1 deletions

View File

@ -10,4 +10,4 @@
* Ensure needed modules load at boot time * Ensure needed modules load at boot time
* Load one needed module (for Debian) one time * Load one needed module (for Debian) one time
* Update README.md file. * Update README.md file.
* Add a defined type to manage IPMI's user. * Add a defined type to manage IPMI's user and channel.

View File

@ -0,0 +1,34 @@
# == Define: ipmi::ressource::channel
#
# Manage channel's configuration
#
# === Parameters
#
# [*channel_id*]
#
define ipmi::ressource::channel ( $channel_id = $title, $ipaddr = '0.0.0.0', $netmask = '0.0.0.0', $remote_access = 'on' ) {
Exec {
path => ['/bin','/sbin','/usr/bin','/usr/sbin'],
logoutput => 'on_failure',
}
# Set IP Address
exec { "IPMI set IP ${ipaddr}":
command => "ipmitool -I open lan set ${channel_id} ipaddr ${ipaddr}",
unless => "ipmitool -I open lan print ${channel_id} | grep '^IP .* ${ipaddr}'",
}
->
# Set Netmask
exec { "IPMI set MASK ${netmask}":
command => "ipmitool -I open lan set ${channel_id} netmask ${netmask}",
unless => "ipmitool -I open lan print ${channel_id} | grep 'Mask .* ${netmask}'",
}
->
# Enable remote access
exec { "IPMI set remote access to ${remote_access} for channel ${channel_id}":
command => "ipmitool -I open lan set ${channel_id} access ${remote_access}",
onlyif => "ipmitool -I open channel info ${channel_id} | grep -i 'Access Mode .* disable'",
}
} # Public ressource: ipmi::ressource::channel

View File

@ -30,6 +30,7 @@
# Ensure this user is +enable+ or +disable+. # Ensure this user is +enable+ or +disable+.
# #
define ipmi::ressource::user ( $user = $title, $password, $user_id = '2', $channel_id = '1', $state = 'enable' ) { define ipmi::ressource::user ( $user = $title, $password, $user_id = '2', $channel_id = '1', $state = 'enable' ) {
Exec { Exec {
path => ['/bin','/sbin','/usr/bin','/usr/sbin'], path => ['/bin','/sbin','/usr/bin','/usr/sbin'],
logoutput => 'on_failure', logoutput => 'on_failure',