-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkdevsrv.sh
executable file
·88 lines (84 loc) · 1.76 KB
/
mkdevsrv.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -xeuo pipefail
#curl -X GET \
#-H "Content-Type: application/json" \
#-H "X-Auth-Token: <fillme> \
#"https://api.equinix.com/metal/v1/operating-systems"
hw_id="$1"
project=${PROJECT:-"c4cb8ea2-12aa-4dc4-ad8d-aa559aafe7d5"}
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $(mvault internal kv get -field=auth-token kv/equinix/metal)" \
"https://api.equinix.com/metal/v1/projects/${project}/devices" \
-d "{
\"hardware_reservation_id\":\"${hw_id}\",
\"hostname\": \"tipi\",
\"operating_system\": \"ubuntu_22_04\",
\"storage\": {
\"disks\": [
{
\"device\": \"/dev/sda\",
\"wipeTable\": true,
\"partitions\": [
{
\"label\": \"BIOS\",
\"number\": 1,
\"size\": \"512M\"
},
{
\"label\": \"SWAP\",
\"number\": 2,
\"size\": \"3993600\"
},
{
\"label\": \"ROOT\",
\"number\": 3,
\"size\": 0
}
]
}
],
\"filesystems\": [
{
\"mount\": {
\"device\": \"/dev/sda1\",
\"format\": \"vfat\",
\"point\": \"/boot/efi\",
\"create\": {
\"options\": [
\"32\",
\"-n\",
\"EFI\"
]
}
}
},
{
\"mount\": {
\"device\": \"/dev/sda3\",
\"format\": \"ext4\",
\"point\": \"/\",
\"create\": {
\"options\": [
\"-L\",
\"ROOT\"
]
}
}
},
{
\"mount\": {
\"device\": \"/dev/sda2\",
\"format\": \"swap\",
\"point\": \"none\",
\"create\": {
\"options\": [
\"-L\",
\"SWAP\"
]
}
}
}
]
}
}"