create device etc

master
root 4 years ago
parent ee32ec10d3
commit fa89dcbf7f

@ -1,17 +0,0 @@
#!/bin/bash
# eqx-cluster-create
#
# Create a cluster of bare metal on Equinix
#
# Usage:
# eqx-cluster-create
# Example:
# eqx-cluster-create
#
set -x
#
EQXRANDHOST=`dd bs=12 count=1 if=/dev/random 2>/dev/null | base64 | tr [:upper:] [:lower:] | tr -dc [:alpha:]`

@ -0,0 +1,66 @@
# eqx-cluster-create
#
# Create a cluster of bare metal on Equinix.
# Generates random project name if none is given.
# Using existing names will cause issues!
#
# Usage:
# eqx-cluster-create [project name]
# Example:
# eqx-cluster-create foocluster
# eqx-cluster-create
#
# XXX check name isn't in use.
#set -x
# Set static variables here
EQXSPOTMAX="0.18"
EQXFACILITY="da11"
EQXOS="debian_10"
EQXPLAN="c3.small.x86"
EQXTAGS="cluster"
# Probably leave these variables alone
EQXPROJECT="$1"
if [[ $1 == "" ]]
then EQXPROJECT=`eqx-create-project`
else eqx-create-project "$EQXPROJECT"
fi
EQXHOSTNAME=`dd bs=12 count=1 if=/dev/random 2>/dev/null | base64 | tr [:upper:] [:lower:] | tr -dc [:alpha:]`
EQXPROJECTID=`eqx-get-project-uuid $EQXPROJECT`
echo "Spot Max: $EQXSPOTMAX"
echo "Project: $EQXPROJECT"
echo "ProjectID: $EQXPROJECTID"
echo "Facility: $EQXFACILITY"
echo "Plan: $EQXPLAN"
echo "Hostname: $EQXHOSTNAME"
echo "OS: $EQXOS"
echo "Tag: $EQXTAGS"
#cat >> tmpfoo <<EOF
packet device create \
--plan "$EQXPLAN" \
--spot-instance \
--spot-price-max="$EQXSPOTMAX" \
--project-id "$EQXPROJECTID" \
--facility "$EQXFACILITY" \
--hostname "$EQXHOSTNAME" \
--operating-system "$EQXOS" \
--tags "$EQXTAGS"
#EOF
exit
-c, --customdata string Custom data
-r, --hardware-reservation-id string UUID of the hardware reservation
-i, --ipxe-script-url string URL to the iPXE script
-v, --public-ipv4-subnet-size int Size of the public IPv4 subnet
-T, --termination-time string Device termination time: --termination-time="15:04:05"
-u, --userdata string Userdata for device initialization (can not be used with --userdata-file)
--userdata-file string Path to a userdata file for device initialization (can not be used with --userdata)
-a, --always-pxe
-b, --billing-cycle string Billing cycle (default "hourly")

@ -7,8 +7,6 @@
# Example: # Example:
# eqx-delete-project fooproject # eqx-delete-project fooproject
#set -x
EQXPROJECT="$1" EQXPROJECT="$1"
if [[ $1 == "" ]] if [[ $1 == "" ]]
@ -19,8 +17,14 @@ if [[ $1 == "" ]]
exit exit
fi fi
echo "Deleting in one second..."
echo "Project: $EQXPROJECT"
EQXPROJECTID=`eqx-get-project-uuid $EQXPROJECT` EQXPROJECTID=`eqx-get-project-uuid $EQXPROJECT`
echo "ProjectID: $EQXPROJECTID"
sleep 1
packet \ packet \
project \ project \
delete \ delete \

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

Loading…
Cancel
Save