ssh, clusterssh configs

master
root 4 years ago
parent 097bba7aae
commit 6ad11bee64

@ -14,7 +14,8 @@ fi
packet \
device get \
--id $EQXDEVICEID | \
--id $EQXDEVICEID \
2>/dev/null | \
grep -v -e '^+' -e "CREATED" | \
cut -f 4 -d " "

@ -16,7 +16,8 @@ fi
packet \
device get \
--json \
--id $EQXDEVICEID | \
--id $EQXDEVICEID \
2>/dev/null | \
jq '.ip_addresses[2].address' | \
sed -e 's/"//g'

@ -16,7 +16,8 @@ fi
packet \
device get \
--json \
--id $EQXDEVICEID | \
--id $EQXDEVICEID \
2>/dev/null | \
jq '.ip_addresses[0].address' | \
sed -e 's/"//g'

@ -0,0 +1,24 @@
#!/bin/bash
# eqx-get-project-ssh-config
#
# Give a project name, generate an ~/.ssh/config snippet.
EQXPROJECT="$1"
if [[ $1 == "" ]]
then \
echo -e "Need project name, such as:\n"
eqx-get-project-names
echo
exit
fi
echo
echo "# Add to ~/.clusterssh/clusters"
echo -n "$EQXPROJECT "
# For each Device, get hostname and IP
for EQXDEVICEID in `eqx-get-project-devices-id "$EQXPROJECT"`
do \
echo -n "`eqx-get-deviceid-hostname $EQXDEVICEID` "
done
echo

@ -1,4 +1,5 @@
#!/bin/bash
eqx-get-projects | jq --raw-output '.[] | {name}' | grep name | cut -f 2 -d ":" | sed -e 's/ //g' -e 's/"//g' | sort -V
eqx-get-projects \
| jq --raw-output '.[] | {name}' | grep name | cut -f 2 -d ":" | sed -e 's/ //g' -e 's/"//g' | sort -V

@ -13,6 +13,16 @@ if [[ $1 == "" ]]
exit
fi
# Get Project Device IDs
eqx-get-project-devices-id "$EQXPROJECT"
echo
echo "# Add to ~/.ssh/config"
echo "# $EQXPROJECT"
# For each Device, get hostname and IP
for EQXDEVICEID in `eqx-get-project-devices-id "$EQXPROJECT"`
do \
echo "Host `eqx-get-deviceid-hostname $EQXDEVICEID`"
echo -e "\tHostname `eqx-get-deviceid-ip-public $EQXDEVICEID`"
echo -e "\tUser root"
echo -e "\tPort 22"
done
echo

Loading…
Cancel
Save