You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eqx/eqx-create-device

98 lines
3.1 KiB

# 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
EQXIPXEURL="https://code.forksand.com/forksand/eqx/raw/branch/master/ipxe-install-debian-10"
EQXFACILITY="da11"
EQXFACILITY2="am6"
EQXFACILITY3="sg1"
4 years ago
#EQXOS="debian_10"
EQXOS="custom_ipxe"
EQXPLAN="m3.large.x86"
EQXTAGS="cluster"
EQXSPOTOVER=".05"
# Probably leave these variables alone
4 years ago
# Set max price at current spot plus EQXSPOTOVER from above
EQXSPOT="`eqx-market-spot-prices`"
EQXSPOTMAX=`echo "$EQXSPOT + $EQXSPOTOVER" | bc -l | xargs printf "%1.2f"`
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`
4 years ago
echo "Spot: $EQXSPOT"
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"
packet device create \
--plan "$EQXPLAN" \
--spot-instance \
--spot-price-max="$EQXSPOTMAX" \
--project-id "$EQXPROJECTID" \
--facility "$EQXFACILITY" \
4 years ago
--hostname "$EQXPROJECT-$EQXFACILITY" \
--operating-system "$EQXOS" \
--ipxe-script-url "$EQXIPXEURL" \
--tags "$EQXTAGS"
# XXX
exit
packet device create \
--plan "$EQXPLAN" \
--spot-instance \
--spot-price-max="$EQXSPOTMAX" \
--project-id "$EQXPROJECTID" \
--facility "$EQXFACILITY2" \
4 years ago
--hostname "$EQXPROJECT-$EQXFACILITY2" \
--operating-system "$EQXOS" \
--ipxe-script-url "$EQXIPXEURL" \
--tags "$EQXTAGS"
packet device create \
--plan "$EQXPLAN" \
--spot-instance \
--spot-price-max="$EQXSPOTMAX" \
--project-id "$EQXPROJECTID" \
--facility "$EQXFACILITY3" \
4 years ago
--hostname "$EQXPROJECT-$EQXFACILITY3" \
--operating-system "$EQXOS" \
--ipxe-script-url "$EQXIPXEURL" \
--tags "$EQXTAGS"
exit
-c, --customdata string Custom data
-r, --hardware-reservation-id string UUID of the hardware reservation
-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")