Change IPMI Passwords for all Nutanix Hosts via Script
Here’s a simple script to help change all IPMI passwords for all Nutanix Hosts in a Cluster.
Just make sure you update the Current Password and New Password in the script, then run from the Controller VM (CVM).
#!/bin/bash
# Changing the IPMI password on all hosts within a Nutanix Cluster
#
# Note: Do not use the following special characters in the IPMI password: & ; ` ' \ " | * ? ~ < > ^ ( ) [ ] { } $ \n \r
#
#define Current Password
SMCOLD=ADMIN
#define New Password
SMCNEW=NewPassword
#generate list of IPMI IPs
smcip(){
ncli host list | grep -w "IPMI Address" | awk {'print $4'};
}
#generate list of Host IDs
hostid(){
ncli host list | grep -w "ID" | awk {'print $3'};
}
#use IPMI tool to change password
#the Close Session command failed output is expected after change completes
for i in `smcip`; do ipmitool -H $i -U ADMIN -P $SMCOLD user set password 2 $SMCNEW; done
#update zeus config with new password
for h in `hostid`; do ncli host edit id=$h ipmi-password=$SMCNEW; done
Leave a Reply