-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidrac_modify.sh
More file actions
55 lines (50 loc) · 1.82 KB
/
idrac_modify.sh
File metadata and controls
55 lines (50 loc) · 1.82 KB
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
#!/bin/bash
drac_root="root"
drac_pass="calvin"
#servers="127.0.0.1"
pxe1=false
bootorder=false
power=false
inventory=false
qq=false
bootverify=false
while [[ $# -gt 0 ]] && [[ ."$1" = .--* ]] ;
do
opt=$1;
shift;
case "$opt" in
"--pxe1" ) pxe1=true; echo "Allowing PXE on tthe first NIC";;
"--bootorder" ) bootorder=true; echo "Changing boot order to use first NIC";;
"--inventory" ) inventory=true; echo "Collecting inventory data using ipmitool";;
"--power" ) power=true; echo "And rebooting server";;
"--queue" ) qq=true; echo "Print queue status";;
"--bootverify" ) bootverify=true; echo "Verify boot order";;
esac
done
for server in $servers
do
if $inventory; then
nic1_id=`sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm getsysinfo" | grep "NIC.Integrated.1-1-1" | awk '{print \$4}'`
echo "$server $nic1_id"
fi
if $bootverify; then
bootv=`sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm get BIOS.BiosBootSettings.BootSeq."`
echo "$server $bootv"
fi
if $pxe1; then
sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm set nic.nicconfig.1.legacybootproto PXE"
sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm jobqueue create NIC.Integrated.1-1-1"
fi
if $bootorder; then
sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm set BIOS.BiosBootSettings.BootSeq NIC.Integrated.1-1-1"
sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm jobqueue create BIOS.Setup.1-1"
fi
if $qq; then
status=`sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm jobqueue view" | grep "Message"`
echo "$server job status is $status"
fi
if $power; then
sshpass -p "$drac_pass" ssh "$drac_root"@"$server" "racadm serveraction powercycle"
echo "Server $server power cycled"
fi
done