Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340567 )

Change subject: mgmt: script to change mgmt password on HP servers
......................................................................


mgmt: script to change mgmt password on HP servers

Change-Id: I5691f4c0242166813df3307914e292f3c6b0c223
---
A modules/mgmt/files/changepwhp
1 file changed, 45 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/mgmt/files/changepwhp b/modules/mgmt/files/changepwhp
new file mode 100644
index 0000000..6f2e05f
--- /dev/null
+++ b/modules/mgmt/files/changepwhp
@@ -0,0 +1,45 @@
+#!/bin/bash
+# change the password of a ILO mgmt interface
+# (c) Papaul Tshibamba, Wikimedia Foundation Inc. 2016
+#sshpass needs to be installed on the host from where this script will run
+echo -n "Enter ILO root password (password will not be displayed):"
+read -s ILOPASS
+echo
+echo -n "Enter ILO root new password (password will not be displayed):"
+read -s ILO_NEW_PASS
+echo
+
+#Host ip list file location
+host_list=ip_list.txt
+
+#Logfile to keep the logs of the execution
+logfile=config.log
+ #get a list of IPs for the servers
+        function getServers () {
+                cat $host_list
+}
+
+        #check if the file with the hosts IPs exist
+        if [ ! -r $host_list ]; then
+                echo "IP address file $host_list not found or cannot be read"
+                exit
+        #Make a log file. The logfile gets overwritten at each exection
+                else echo "Starting Bash configuration of HP ILO for file 
$host_list" >$logfile
+
+        fi
+for host_ip in $(getServers); do
+        echo "========================================" >> $logfile
+        echo "Changing ILO password for  $host_ip " >>$logfile
+
+        sshpass -p "$ILOPASS" ssh -o StrictHostKeyChecking=no -l root $host_ip 
set /map1/accounts1/root password="$ILO_NEW_PASS" | sed s/$ILO_NEW_PASS/XXXXX/g 
 >>$logfile 2>&1
+
+        if [ $? -ne 0 ]; then
+                echo "Failed. See logfile for details"
+        else
+                echo "ILO configured successfully on $host_ip"
+        fi
+
+
+
+done <$host_list
+echo " complete"

-- 
To view, visit https://gerrit.wikimedia.org/r/340567
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5691f4c0242166813df3307914e292f3c6b0c223
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Papaul <ptshiba...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: RobH <r...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to