Dzahn has submitted this change and it was merged.

Change subject: salt-misc: set bastion host based on realm as $2
......................................................................


salt-misc: set bastion host based on realm as $2

Add an optional second parameter $2/$realm which sets
the correct bastion host whether we are a root in prod,
a root in labs, a non-root in prod or a non-root in labs.

Change-Id: I0c1857f6d5296514067e58d76ad4cbb1fd340343
---
M salt-misc/gather-minion-info.sh
1 file changed, 25 insertions(+), 10 deletions(-)

Approvals:
  Dzahn: Verified; Looks good to me, approved



diff --git a/salt-misc/gather-minion-info.sh b/salt-misc/gather-minion-info.sh
index 25c7b68..761ff2b 100755
--- a/salt-misc/gather-minion-info.sh
+++ b/salt-misc/gather-minion-info.sh
@@ -9,20 +9,35 @@
 fi
 
 if [ -z "$1" ]; then
-    echo "Usage: $0 filename"
+    echo "Usage: $0 filename [realm]"
     echo "filename should have list of fqdn of instances to check, one per 
line"
+    echo "realm is optional and should be one of 'ops', 'prod', 'opslabs' or 
'labs'. default is opslabs"
     exit 1
 fi
+
+case "$2" in
+ 'ops')
+    BASTION="iron.wikimedia.org" ;;
+ 'prod')
+    BASTION="bast1001.wikimedia.org" ;;
+ 'opslabs')
+    BASTION="bastion-restricted.wmflabs.org" ;;
+ 'labs')
+    BASTION="bastion.wmflabs.org" ;;
+ *)
+    BASTION="bastion-restricted.wmflabs.org" ;;
+esac
+
 hostlist=`cat $1`
 
 for minion in $hostlist; do
-    echo "doing $minion"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "ls -lt /var/log/salt/minion"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "tail -20 /var/log/salt/minion"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "cat /etc/salt/minion"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" 'ps axuww | grep salt | grep -v axuww'
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "dpkg -l | grep salt"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "cat /etc/issue"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "ls -lt /var/log/puppet.log"
-        $SSH bastion-restricted.wmflabs.org ssh -l root -o 
'StrictHostKeyChecking=no' "$minion" "tail -40 /var/log/puppet.log"
+    echo "doing $minion - using bastion $BASTION"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" "ls 
-lt /var/log/salt/minion"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" 
"tail -20 /var/log/salt/minion"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" "cat 
/etc/salt/minion"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" "ps 
axuww | grep salt | grep -v axuww"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" 
"dpkg -l | grep salt"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" "cat 
/etc/issue"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" "ls 
-lt /var/log/puppet.log"
+        $SSH $BASTION ssh -l root -o 'StrictHostKeyChecking=no' "$minion" 
"tail -40 /var/log/puppet.log"
 done

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0c1857f6d5296514067e58d76ad4cbb1fd340343
Gerrit-PatchSet: 5
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: Dzahn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to