Skip to content

Instantly share code, notes, and snippets.

@joneskoo
Created November 26, 2014 19:09
Show Gist options
  • Save joneskoo/f3688a2e38d27d34dbf5 to your computer and use it in GitHub Desktop.
Save joneskoo/f3688a2e38d27d34dbf5 to your computer and use it in GitHub Desktop.
#cloud-config
apt_update: true
apt_upgrade: true
packages:
- augeas-tools
- screen
- curl
- wget
- build-essential
- git-core
- p7zip-full
ssh_pwauth: False
users:
- name: fuzz
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- ssh-rsa ...
#!/bin/bash
set -e
HOSTNAME=$1
DOMAIN=do.yx.fi
IMAGE="ubuntu-14-04-x64"
REGION=lon1
SIZE=512mb
SSH_KEY=1b:bb:5c:85:8c:50:7f:eb:43:86:ca:b7:27:67:fc:2a
if [[ -z $HOSTNAME ]]; then
echo Usage: start-vm HOSTNAME
exit 1
fi
if [[ -z $DO_API_TOKEN ]]; then
echo Set DO_API_TOKEN environment variable first
exit 1
fi
http -v --json post "https://api.digitalocean.com/v2/droplets" \
Authorization:"Bearer ${DO_API_TOKEN}" \
name=$HOSTNAME.do.yx.fi \
region=$REGION \
size=$SIZE \
[email protected] \
ssh_keys:="[\"$SSH_KEY\"]" \
image="$IMAGE"
@joneskoo
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment