-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_node_vars.sh
More file actions
executable file
·51 lines (37 loc) · 988 Bytes
/
create_node_vars.sh
File metadata and controls
executable file
·51 lines (37 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Create a new node on Digital Ocean
# By Jason Gegere <jason@htmlgraphic.com>
function quit {
exit
}
function create_node {
echo "TIP: Create the environmental variable 'DO_TOKEN' with your Digital Ocean key"
read -p "Would you like to create a new Digital Ocean node? [y/n]" create
if [ "$create" == "y" ]; then
echo "Creating node..."
elif [ "$create" != "n" ] || [ "$create" == "n" ]; then
quit
fi
#CLOUD_INIT=echo | cat cloud-config.yaml
VARS=$(cat <<EOF
{
"name": "coreos71",
"backups" : false,
"region" : "nyc3",
"size" : "512mb",
"private_networking" : true,
"image" : "coreos-stable",
"ssh_keys" : [98825],
"user_data" : "$(cat cloud-config.yaml)"
}
EOF
)
echo "${VARS}"
echo "${DO_TOKEN}"
curl -X POST "https://api.digitalocean.com/v2/droplets" \
-H "Content-type: application/json" \
-H "Authorization: Bearer ${DO_TOKEN}" \
-d "${VARS}"
}
create_node
quit