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).

# 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

#define New Password

#generate list of IPMI IPs
ncli host list | grep -w "IPMI Address" | awk {'print $4'};

#generate list of Host IDs
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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top