#!/bin/bash #Script for configuring iLO - modified version, works with hponcfg-4.2.0-0.i386.rpm #set -x function configure-ilo() { echo "Now running $FUNCNAME...." #Install hponcfg #yum install -y hponcfg #Reset to factory defaults (just in case) hponcfg -r #Dynamic values for the generated XML ILONAME="$(hostname -s)-iLO" ILOIP="$(dig -x @DNS_SERVER_IP $ILONAME.$TLD +short)" #VLAN verification and configuration case $ILOIP in 172.16.10*.*) GATEWAY=172.16.103.254 NETMASK=255.255.252.0 ENABLEV=Y VLAN=101 ;; 172.16.11*.*) GATEWAY=172.16.115.254 NETMASK=255.255.252.0 ENABLEV=Y VLAN=112 ;; 172.17.1.*) GATEWAY=0.0.0.0 NETMASK=255.255.252.0 ENABLEV=N VLAN=243 ;; 172.17.2.*) GATEWAY=0.0.0.0 NETMASK=255.255.252.0 ENABLEV=N VLAN=243 ;; esac #Build xml config file for ILO cat > /tmp/ilo.dat < ENDILO #Apply config to the ILO card hponcfg -f /tmp/ilo.dat echo "iLO configured on $ILONAME, IP: $ILOIP" } #configure-ilo ########################################################################################## ## Control logic for the script ## ########################################################################################## main() { echo "Configuring iLo on $ILONAME at $(date)" configure-ilo } main