echo -n "###### `date --rfc-3339=seconds` STORAGE AUTO-DEPLOY "
echo $@
}
+# ----
rexec() {
local srv="$1" ; shift
}
# ----
+ipmi() {
+ local host="$1" # hihi
+ shift
+ ipmitool -H "$host" -U ADMIN -P ADMIN $@
+}
+
while_with_timeout() {
local timeout="$1"
if [ "$2" = "not" ] ; then
#
# M A I N
#
-
+set -x
main() {
- [ $# -ne 1 ] && {
+ [ $# -ne 2 ] && {
echo
- echo " USAGE: $0 <remote-ip>"
+ echo " USAGE: $0 <remote-ip> <remote-ipmi-ip>"
echo " remote-ip IP address of the remote to be "
- echo " converted into a storage server."
+ echo " converted into a storage server."
+ echo " remote-ipmi-ip IP address of the remote IPMI "
+ echo " service."
echo
exit 1
}
local storage_ip="$1"
+ local storage_ipmi="$2"
+
+ log " Resetting $storage_ip and booting from PXE (via $storage_ipmi)"
+ ipmi "$storage_ipmi" chassis bootdev pxe || { log " FAILED to set bootdev pxe via ipmi."; return 1; }
+ ipmi "$storage_ipmi" chassis power reset || { log " FAILED to reset server via ipmi."; return 1; }
- wait_until_online 100 "$storage_ip" || return 1
+ wait_for_reboot 600 "$storage_ip" || return 1
log " Cloning pb-overlay in initial bootstrap system"
rexec "$storage_ip" "cd /tmp && git clone git://git/so/pb-overlay.git" \
rexec "$storage_ip" "cd /tmp/pb-overlay/scripts && ./install-gentoo-storage" \
|| return 1
- log " Rebooting"
+ log " Setting boot device to 'disk' and rebooting"
+ ipmi "$storage_ipmi" chassis bootdev disk || { log " FAILED to set bootdev disk via ipmi."; return 1; }
rexec "$storage_ip" "reboot" || return 1
- wait_for_reboot 100 $storage_ip || { log " ABORT"; return 1; }
+ wait_for_reboot 600 $storage_ip || { log " ABORT"; return 1; }
log " Cloning pb-overlay in storage root FS"
rexec "$storage_ip" "cd /tmp && git clone git://git/so/pb-overlay.git" \
log " Rebooting"
rexec "$storage_ip" "reboot" || return 1
- wait_for_reboot 100 $storage_ip || { log " ABORT"; return 1; }
+ wait_for_reboot 600 $storage_ip || { log " ABORT"; return 1; }
log " S U C C E S S"
log " Your storage server is now available at $storage_ip."