-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrestoptions
94 lines (80 loc) · 2.75 KB
/
restoptions
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
89
90
91
92
93
#!/bin/bash
#
# restoptions: tools for using RESTful API with Fujitsu iRMC S4/S5
#
# (c) Juergen Orth - Fujitsu Technology Solutions GmbH
#
# $Id: restoptions 184 2023-04-20 07:36:01Z HMBJOrth $
################################################################################
#
# Default-Settings
# ================
#
# Can/should be adjusted according to user preferences
#
################################################################################
# iRMC settings
IRMC=${IRMC:-10.172.124.82}
# USER: iRMC User with appropriate rights (default: administrator)
USER=${IRMC_CRED%:*}
USER=${USER:-admin} # if iRMC_CRED not set use defaults
# PD: Password for above USER (default: admin)
PW=${IRMC_CRED#*:}
PW=${PW:-${DCDEFAULTPW:-admin}} # if iRMC_CRED not set use defaults
# Profile settings
DEFAULTPROFILE=IrmcConfig/BootConfig
JSON=profile.json # Filename of profile json string
POSTOPTION="" # Option for Post (inhibit reboot)
# Custom image settings
CUSTOMIMAGEURLPATH="http://10.172.125.100/DownloadManager/globalflash/iso"
CUSTOMIMAGENAME=customimage
CUSTOMIMAGESUFFIX="iso"
# Deploy settings
DEFAULTOSID=3
DEFAULTOS=deploy/esxi67u3_IDE_m2.json
# Reset options
RESETWAITTIME=10 # Waittime before performing reset
# Debug settings
DEBUGLEVEL=0 # Debuglevel: 0=nothing, 1=low, 2=medium, 3=high
export IRMC USER PW DEFAULTPROFILE JSON POSTOPTION CUSTOMIMAGEURLPATH CUSTOMIMAGESUFFIX DEFAULTOSID DEFAULTOS RESETWAITTIME DEBUGLEVEL
################################################################################
#
# End of user settings - DON'T CHANGE LINES BELOW!
#
################################################################################
PROGNAME=${0##*/}
case $PROGNAME in
restgetprofile) PARAMOPT="[-f <filename> ($JSON)] [<profilename> ($DEFAULTPROFILE)]";;
restsetprofile) PARAMOPT="[-n (noreboot)] [<filename> ($JSON)]";;
restloadsvim) PARAMOPT="[<OsTypeId> ($DEFAULTOSID)]";;
restsetdeploy) PARAMOPT="<DeployParam.xml>";;
restdeployos) PARAMOPT="<filename> ($DEFAULTOS)]";;
restrun) PARAMOPT="<function> [param ..]";;
restuploadci) PARAMOPT="<http(s)-URL>";;
restbootci) PARAMOPT="<customimagefile_without_iso>";;
restdeleteci) PARAMOPT="<customimagefile_without_iso>";;
restgetbootmac) PARAMOPT="[onboard|lom] [port] # port>=1";;
chasset) PARAMOPT="[asset entries]";;
*) PARAMOPT="";;
esac
# Display usage
usage()
{
echo "Usage: ${0##*/} [-h (help)] [-i <iRMC name/IP> ($IRMC)] [-u <user> ($USER)] [-p <password> ($PW)] [-d <debuglevel> ($DEBUGLEVEL)] " $PARAMOPT >&2
exit 2
}
# Evaluate commandline parameters
while getopts "i:u:p:f:nd:h" OPT
do
case $OPT in
i) IRMC=$OPTARG;;
u) USER=$OPTARG;;
p) PW=$OPTARG;;
f) JSON=$OPTARG;;
d) DEBUGLEVEL=$OPTARG;;
n) POSTOPTION="?inhibit_reboot";;
h) usage;;
?) usage;;
esac
done
shift $(($OPTIND-1))