* Add the possibility to choose between static, dhcp, bios or none for the channel network configuration.

This commit is contained in:
gardouille 2015-05-19 17:40:46 +02:00
parent a8d67c7915
commit fc1c6576eb
2 changed files with 33 additions and 10 deletions

View File

@ -5,6 +5,7 @@
##### Changes
* Correct some warnings from Puppet-lint.
* Add the possibility to choose between static, dhcp, bios or none for the channel network configuration.
##### Bugfixes
* #2 Add a test for ipmi::ressource::user

View File

@ -24,23 +24,45 @@
#
# 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' ) {
define ipmi::ressource::channel ( $channel_id = $title, $ipsrc = 'static', $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}'",
case $ipsrc {
'static': {
# 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}'",
}
}
default: {
# Nothing to do
}
}
->
# 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}'",
# Set the IP Address source for the channel
exec { "Set ${ipsrc} IP for channel ${channel_id}":
command => "ipmitool -I open lan set ${channel_id} ipsrc ${ipsrc}",
unless => $ipsrc ? {
'static' => "ipmitool lan print ${channel_id} | grep -i '^IP Address Source.* Static'",
'dhcp' => "ipmitool lan print ${channel_id} | grep -i '^IP Address Source.* DHCP'",
'bios' => "ipmitool lan print ${channel_id} | grep -i '^IP Address Source.* BIOS'",
'none' => "ipmitool lan print ${channel_id} | grep -i '^IP Address Source.* Unspecified'",
}
}
->
# Enable remote access