diff --git a/CHANGELOG.md b/CHANGELOG.md index bce3ba7..444e007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,4 +10,4 @@ * Ensure needed modules load at boot time * Load one needed module (for Debian) one time * Update README.md file. -* Add a defined type to manage IPMI's user. +* Add a defined type to manage IPMI's user and channel. diff --git a/manifests/ressource/channel.pp b/manifests/ressource/channel.pp new file mode 100644 index 0000000..079a4cb --- /dev/null +++ b/manifests/ressource/channel.pp @@ -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 diff --git a/manifests/ressource/user.pp b/manifests/ressource/user.pp index c28c1e8..14b0b9d 100644 --- a/manifests/ressource/user.pp +++ b/manifests/ressource/user.pp @@ -30,6 +30,7 @@ # Ensure this user is +enable+ or +disable+. # define ipmi::ressource::user ( $user = $title, $password, $user_id = '2', $channel_id = '1', $state = 'enable' ) { + Exec { path => ['/bin','/sbin','/usr/bin','/usr/sbin'], logoutput => 'on_failure',