* Add a defined type to manage IPMI's user.
This commit is contained in:
parent
b048db6511
commit
4eb0027c72
@ -10,3 +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.
|
||||
|
57
manifests/ressource/user.pp
Normal file
57
manifests/ressource/user.pp
Normal file
@ -0,0 +1,57 @@
|
||||
# == 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
|
Loading…
Reference in New Issue
Block a user