lib/cac.sh: add cac_ssh
This commit is contained in:
parent
ee82c6df3a
commit
b95a514bcc
16
lib/cac.sh
16
lib/cac.sh
@ -1,5 +1,21 @@
|
|||||||
. ./lib/url.sh
|
. ./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() {(
|
cac_getserver_by_servername() {(
|
||||||
serverlist=$(cac_listservers)
|
serverlist=$(cac_listservers)
|
||||||
|
Loading…
Reference in New Issue
Block a user