Browse Source

prices, ipxe

master
root 2 years ago
parent
commit
11a6eafe60
  1. 8
      eqx-create-device
  2. 13
      eqx-market-spot-prices
  3. 6
      ipxe-install-debian-10

8
eqx-create-device

@ -16,13 +16,16 @@
#set -x
# Set static variables here
EQXSPOTMAX="0.18"
EQXFACILITY="da11"
EQXOS="debian_10"
EQXPLAN="c3.small.x86"
EQXTAGS="cluster"
EQXSPOTOVER=".02"
# Probably leave these variables alone
# 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`
@ -32,6 +35,7 @@ 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: $EQXSPOT"
echo "Spot Max: $EQXSPOTMAX"
echo "Project: $EQXPROJECT"
echo "ProjectID: $EQXPROJECTID"
@ -41,7 +45,6 @@ echo "Hostname: $EQXHOSTNAME"
echo "OS: $EQXOS"
echo "Tag: $EQXTAGS"
#cat >> tmpfoo <<EOF
packet device create \
--plan "$EQXPLAN" \
--spot-instance \
@ -51,7 +54,6 @@ packet device create \
--hostname "$EQXHOSTNAME" \
--operating-system "$EQXOS" \
--tags "$EQXTAGS"
#EOF
exit
-c, --customdata string Custom data

13
eqx-market-spot-prices

@ -0,0 +1,13 @@
#!/bin/bash
# eqx-market-spot-prices
EQXTOKEN=`cat ~/.packet-cli.json | jq ".token" --raw-output`
curl \
--silent \
-X GET \
--header 'Accept: application/json' \
--header "X-Auth-Token: ${EQXTOKEN}" \
'https://api.equinix.com/metal/v1/market/spot/prices' | \
jq '.spot_market_prices.da11."c3.small.x86".price'

6
ipxe-install-debian-10

@ -0,0 +1,6 @@
#!ipxe
kernel https://boot.netboot.xyz/memdisk iso raw
initrd https://gemmei.ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-10.7.0-amd64-netinst.iso
boot
Loading…
Cancel
Save