summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-05-20 22:30:00 +0200
committertv <tv@shackspace.de>2015-05-20 22:30:00 +0200
commitb95a514bcced00af77ae4adab77326dba9ab4c36 (patch)
treef17c8e157a05d9e67b1eb54ab678785ad0034325
parentee82c6df3a43c73f44f3af2125ed5e21a408061c (diff)
lib/cac.sh: add cac_ssh
-rw-r--r--lib/cac.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/cac.sh b/lib/cac.sh
index c78576ebf..fea6886be 100644
--- a/lib/cac.sh
+++ b/lib/cac.sh
@@ -1,5 +1,21 @@
. ./lib/url.sh
+cac_ssh() {(
+ server=$1
+ shift
+
+ address=$(echo $server | jq -r .ip)
+ target=root@$address
+
+ SSHPASS=$(echo $server | jq -r .rootpass)
+ export SSHPASS
+
+ exec sshpass -e ssh \
+ -o StrictHostKeyChecking=no \
+ -o UserKnownHostsFile=/dev/null \
+ "$target" \
+ "$@"
+)}
cac_getserver_by_servername() {(
serverlist=$(cac_listservers)