diff options
author | tv <tv@shackspace.de> | 2015-05-20 22:30:00 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-05-20 22:30:00 +0200 |
commit | b95a514bcced00af77ae4adab77326dba9ab4c36 (patch) | |
tree | f17c8e157a05d9e67b1eb54ab678785ad0034325 /lib | |
parent | ee82c6df3a43c73f44f3af2125ed5e21a408061c (diff) |
lib/cac.sh: add cac_ssh
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cac.sh | 16 |
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) |