Dzahn has submitted this change and it was merged.
Change subject: script to change mgmt password
......................................................................
script to change mgmt password
Change-Id: Iae0ca122cc471a1623d821ed72046fab6d40e942
---
A modules/mgmt/files/changepw
M modules/mgmt/manifests/init.pp
2 files changed, 52 insertions(+), 0 deletions(-)
Approvals:
Dzahn: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/mgmt/files/changepw b/modules/mgmt/files/changepw
new file mode 100644
index 0000000..2a4c315
--- /dev/null
+++ b/modules/mgmt/files/changepw
@@ -0,0 +1,46 @@
+!/bin/bash
+# change the password of a DRAC 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 iDRAC root password (password will not be displayed):"
+read -s DRACPASS
+echo
+echo -n "Enter IDRAC root new password (password will not be displayed):"
+read -s DRAC_NEW_PASS
+echo
+
+#Host ip list file location
+host_list=ip_list.txt
+#Dell Racadm command
+#sshpass -p "$DRACPASS" ssh -o StrictHostKeyChecking=no root@$host_ip racadm
config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 "$DRAC_NEW_PASS"
+#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 Dell Drac for file
$host_list" >$logfile
+fi
+
+
+for host_ip in $(getServers); do
+ echo "========================================" >> $logfile
+ echo "Changing DRAC password for $host_ip " >>$logfile
+
+ sshpass -p "$DRACPASS" ssh -o StrictHostKeyChecking=no root@$host_ip
racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 "$DRAC_NEW_PASS"
>>$logfile 2>&1
+
+ if [ $? -ne 0 ]; then
+ echo "Failed. See logfile for details"
+ else
+ echo "DRAC configured successfully on $host_ip"
+ fi
+done <$host_list
+echo " complete"
+
diff --git a/modules/mgmt/manifests/init.pp b/modules/mgmt/manifests/init.pp
index e7a8bc8..0a7a896 100644
--- a/modules/mgmt/manifests/init.pp
+++ b/modules/mgmt/manifests/init.pp
@@ -6,5 +6,11 @@
package { 'sshpass':
ensure => present,
}
+ file { '/usr/local/bin/changepw':
+ mode => '0500',
+ owner => 'root',
+ group => 'root',
+ source => 'puppet:///modules/mgmt/changepw',
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/318650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iae0ca122cc471a1623d821ed72046fab6d40e942
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Papaul <[email protected]>
Gerrit-Reviewer: Cmjohnson <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: RobH <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits