Browse Source

get ips etc

master
root 1 year ago
parent
commit
097bba7aae
  1. 20
      eqx-get-deviceid-hostname
  2. 22
      eqx-get-deviceid-ip-private
  3. 22
      eqx-get-deviceid-ip-public
  4. 22
      eqx-get-deviceid-ipv6
  5. 18
      eqx-get-project-ssh-config

20
eqx-get-deviceid-hostname

@ -0,0 +1,20 @@
#!/bin/bash
# eqx-get-deviceid-hostname
#
# Give a device ID, get hostname
EQXDEVICEID="$1"
if [[ $1 == "" ]]
then \
echo -e "Need device name"
echo
exit
fi
packet \
device get \
--id $EQXDEVICEID | \
grep -v -e '^+' -e "CREATED" | \
cut -f 4 -d " "

22
eqx-get-deviceid-ip-private

@ -0,0 +1,22 @@
#!/bin/bash
# eqx-get-deviceid-ip-private
#
# Give a device ID, get private IP
EQXDEVICEID="$1"
if [[ $1 == "" ]]
then \
echo -e "Need device name"
echo
exit
fi
# get IP
packet \
device get \
--json \
--id $EQXDEVICEID | \
jq '.ip_addresses[2].address' | \
sed -e 's/"//g'

22
eqx-get-deviceid-ip-public

@ -0,0 +1,22 @@
#!/bin/bash
# eqx-get-deviceid-ip-public
#
# Give a device ID, get public IP
EQXDEVICEID="$1"
if [[ $1 == "" ]]
then \
echo -e "Need device name"
echo
exit
fi
# get IP
packet \
device get \
--json \
--id $EQXDEVICEID | \
jq '.ip_addresses[0].address' | \
sed -e 's/"//g'

22
eqx-get-deviceid-ipv6

@ -0,0 +1,22 @@
#!/bin/bash
# eqx-get-deviceid-ip-private
#
# Give a device ID, get private IP
EQXDEVICEID="$1"
if [[ $1 == "" ]]
then \
echo -e "Need device name"
echo
exit
fi
# get IP
packet \
device get \
--json \
--id $EQXDEVICEID | \
jq '.ip_addresses[1].address' | \
sed -e 's/"//g'

18
eqx-get-project-ssh-config

@ -0,0 +1,18 @@
#!/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
# Get Project Device IDs
eqx-get-project-devices-id "$EQXPROJECT"
Loading…
Cancel
Save