From b95a514bcced00af77ae4adab77326dba9ab4c36 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 May 2015 22:30:00 +0200 Subject: lib/cac.sh: add cac_ssh --- lib/cac.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/cac.sh') 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) -- cgit v1.2.3