58 lines
1.4 KiB
Puppet
58 lines
1.4 KiB
Puppet
# == Define: ipmi::ressource::user
|
|
#
|
|
# Manage IPMI's user
|
|
#
|
|
# === Parameters
|
|
#
|
|
# [*user*]
|
|
# _default_: +$title+, the title/name of the ressource/user
|
|
#
|
|
# The username.
|
|
#
|
|
# [*password*]
|
|
# _default_: +undef+
|
|
#
|
|
# The user's password.
|
|
#
|
|
# [*user_id*]
|
|
# _default_: +2+
|
|
#
|
|
# The user ID. This defined type don't create a new user.
|
|
#
|
|
# [*channel_id*]
|
|
# _default_: +1+
|
|
#
|
|
# The channel ID. On most BMC, the main channel (with lan) is the first one.
|
|
#
|
|
# [*state*]
|
|
# _default_: +enable+
|
|
#
|
|
# 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',
|
|
}
|
|
|
|
# Rename the user with the $user_id
|
|
exec { "Rename IPMI UserID ${user_id} to ${user}":
|
|
command => "ipmitool user set name ${user_id} ${name}",
|
|
unless => "ipmitool user list ${channel_id} | grep ${user} | grep ${user_id}",
|
|
}
|
|
->
|
|
# Change the password
|
|
exec { "IPMI ${user} password":
|
|
command => "ipmitool user set password ${user_id} ${password}",
|
|
unless => "ipmitool user test ${user_id} 16 ${password}",
|
|
notify => Exec["Enable IPMI user ${user}"],
|
|
}
|
|
->
|
|
# Enable the IPMI's user
|
|
exec { "Enable IPMI user ${user}":
|
|
command => "ipmitool user ${state} ${user_id}",
|
|
refreshonly => true,
|
|
}
|
|
|
|
} # Public ressource: ipmi::ressource::user
|