ipmi/manifests/ressource/channel.pp

53 lines
1.5 KiB
Puppet

# == Define: ipmi::ressource::channel
#
# Manage channel's configuration
#
# === Parameters
#
# [*channel_id*]
# _default_: +$title+, the title/name of the ressource
#
# Is the channel identifier.
#
# [*ipaddr*]
# _default_: +0.0.0.0+
#
# The ip address to allow remote access from lan.
#
# [*netmask*]
# _default_: +0.0.0.0+
#
# The netmask associated to the previous ip address.
#
# [*remote_access*]
# _default_: +on+
#
# Allow remote access from lan (+on+) or disable it (+off+).
#
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