summaryrefslogtreecommitdiffstats
path: root/server/ipxe
diff options
context:
space:
mode:
authorJannik Schönartz2019-03-18 18:27:55 +0100
committerJannik Schönartz2019-03-18 18:27:55 +0100
commitf486a08621eec271889c4e2108e0038a98e78946 (patch)
tree18150cd68cdcdee42a2a62ce2a124badaf6f4cbb /server/ipxe
parent[server/log] sql JSON to TEXT for mariadb compatibility (diff)
downloadbas-f486a08621eec271889c4e2108e0038a98e78946.tar.gz
bas-f486a08621eec271889c4e2108e0038a98e78946.tar.xz
bas-f486a08621eec271889c4e2108e0038a98e78946.zip
[server/registration] Add server registration
Diffstat (limited to 'server/ipxe')
-rwxr-xr-xserver/ipxe/bash_scripts/addServer.sh31
-rw-r--r--server/ipxe/bash_scripts/grepSystemInfo.sh1
2 files changed, 32 insertions, 0 deletions
diff --git a/server/ipxe/bash_scripts/addServer.sh b/server/ipxe/bash_scripts/addServer.sh
new file mode 100755
index 0000000..13f81d1
--- /dev/null
+++ b/server/ipxe/bash_scripts/addServer.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+json_data()
+{
+ cat << EOF
+{
+ "client": {
+ "parents": [709403],
+ "type": "SERVER",
+ "uuid": "$(dmidecode -q -s system-uuid | grep -v '^#' | head -n 1 | tr '[a-z]' '[A-Z]')",
+ "network": {
+ "mac": "$(cat /sys/class/net/ens3/address)",
+ "ip": "$(hostname -I | awk '{print $1}')"
+ },
+ "location": {
+ "option": "Horizontal",
+ "insertion": "Back",
+ "pos": 46
+ },
+ "formfactor": {
+ "formfactor": "19\"",
+ "rackunits": 1
+ }
+ },
+ "ipxe": false
+}
+EOF
+}
+
+#curl -d "$(json_data)" -H "Content-Type: application/json" -X POST --insecure https://bas.intra.uni-freiburg.de/api/registration
+curl --data "$(json_data)" -H "Content-Type: application/json" -X POST --insecure https://bas.stfu-kthx.net:8888/api/registration \ No newline at end of file
diff --git a/server/ipxe/bash_scripts/grepSystemInfo.sh b/server/ipxe/bash_scripts/grepSystemInfo.sh
index 4ce42ab..63ca5e2 100644
--- a/server/ipxe/bash_scripts/grepSystemInfo.sh
+++ b/server/ipxe/bash_scripts/grepSystemInfo.sh
@@ -17,6 +17,7 @@ MODEL=$(dmidecode -q -s system-product-name)
SERIAL=$(dmidecode -q -s system-serial-number)
VENDOR=$(dmidecode | grep -Eo '(Vendor).*')
VENDOR=${VENDOR#"Vendor: "}
+# VENDOR=$(dmidecode | grep -Eo '(Vendor).*' | cut -f 2 -d ":")
# Mainboard
MAINBOARD_MANUFACTURER=$(dmidecode -q -s baseboard-manufacturer)