From f486a08621eec271889c4e2108e0038a98e78946 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Mon, 18 Mar 2019 17:27:55 +0000 Subject: [server/registration] Add server registration --- server/ipxe/bash_scripts/addServer.sh | 31 ++++++++++++++++++++++++++++++ server/ipxe/bash_scripts/grepSystemInfo.sh | 1 + 2 files changed, 32 insertions(+) create mode 100755 server/ipxe/bash_scripts/addServer.sh (limited to 'server/ipxe') 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) -- cgit v1.2.3-55-g7522