-
-
Save karampok/a47793b5844495e6b37bbcf5f177e206 to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/env bash | |
export AUTH="user:pass" | |
# bios_status https://192.168.X.Y | |
bios_status(){ | |
curl -k -s -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-X GET "$1"/redfish/v1/Systems/1/Bios | |
} | |
power_off(){ | |
curl -k -s --noproxy "*" -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" --globoff -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-d '{"ResetType": "ForceOff"}' \ | |
-X POST "$1"/redfish/v1/Systems/1/Actions/ComputerSystem.Reset | |
} | |
power_on(){ | |
curl -k -s --noproxy "*" -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" --globoff -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-d '{"ResetType": "On"}' \ | |
-X POST "$1"/redfish/v1/Systems/1/Actions/ComputerSystem.Reset | |
} | |
media_insert(){ | |
curl -k -s --noproxy "*" -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" --globoff -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-d '{"Image": "http://192.168.18.10/iso/agent-hpe181.iso"}' \ | |
-X POST "$1"/redfish/v1/Managers/1/VirtualMedia/2/Actions/VirtualMedia.InsertMedia | |
} | |
media_eject() { | |
curl -k -s --noproxy "*" -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" --globoff -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-d '{}' -X POST "$1"/redfish/v1/Managers/1/VirtualMedia/2/Actions/VirtualMedia.EjectMedia | |
} | |
boot_once() { | |
curl -k -s --noproxy "*" -L -u "$AUTH" -w "%{http_code} %{url_effective}\\n" --globoff -H "Content-Type: application/json" -H "Accept: application/json" \ | |
-d '{"Boot":{ "BootSourceOverrideEnabled": "Once", "BootSourceOverrideTarget": "Cd"}}' \ | |
-X PATCH "$1"/redfish/v1/Systems/1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment