Last active
July 2, 2017 14:13
-
-
Save katopz/bc9c6b73a1d09e765e22c263885e3c5c to your computer and use it in GitHub Desktop.
To create DigitalOcean droplet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get name andcs image from arguments | |
NAME=$1 | |
IMAGE=${2:-"ubuntu-16-04-x64"} | |
# Get droplet option | |
DO_OPTION=$(tr -d '\n' < ./droplets.json | tr -d ' ') | |
DO_OPTION=${DO_OPTION/'$NAME'/$NAME} | |
DO_OPTION=${DO_OPTION/'$IMAGE'/$IMAGE} | |
# Create droplet | |
curl -X POST "https://api.digitalocean.com/v2/droplets" \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DO_TOKEN" \ | |
-d $DO_OPTION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment