fi
}
+server_get_ipmicfg() {
+ NODE=$1
+
+ echo "" > /tmp/ipmivars.sh
+
+
+ echo "ipmicfg|${NODE}" | $NETCAT -w 5 ${_server} ${PORT} > /tmp/nc.log
+ if [ "$?" != "0" ];
+ then
+ echo "Can't send message to $_server on port $PORT"
+ else
+ while read LINE
+ do
+ if [ `echo ${LINE} | awk '/OK/ {print $1}'` ]
+ then
+ echo -n ""
+ elif [ `echo ${LINE} | awk '/^ERR/ {print $1}'` ]
+ then
+ clone_fatal_error "Can't get ${NODE} ipmi data from ${_server}"
+ else
+ echo "${LINE}" >> /tmp/ipmivars.sh
+ fi
+
+ done < /tmp/nc.log
+ ok_msg
+
+ source /tmp/ipmivars.sh
+ if [ "${IPMI_LANCHANNEL}" != "" ]
+ then
+ msg -n "Setting mode static on IPMI channel ${IPMI_LANCHANNEL} "
+ ipmitool lan set ${IPMI_LANCHANNEL} ipsrc static >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+ msg -n "Setting IP to ${IPMI_IPADDRESS} on IPMI channel ${IPMI_LANCHANNEL} "
+ ipmitool lan set ${IPMI_LANCHANNEL} ipaddr ${IPMI_IPADDRESS} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+ msg -n "Setting netmask to ${IPMI_NETMASK} on IPMI channel ${IPMI_LANCHANNEL} "
+ ipmitool lan set ${IPMI_LANCHANNEL} netmask ${IPMI_NETMASK} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+ msg -n "Setting gateway to ${IPMI_GATEWAY} on IPMI channel ${IPMI_LANCHANNEL} "
+ ipmitool lan set ${IPMI_LANCHANNEL} defgw ipaddr ${IPMI_GATEWAY} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+ if [ "${IPMI_VLAN}" != "" ]
+ then
+ msg -n "Setting vlan to ${IPMI_VLAN} on IPMI channel ${IPMI_LANCHANNEL} "
+ ipmitool lan set ${IPMI_LANCHANNEL} vlan id ${IPMI_VLAN} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+ fi
+
+
+ if [ "${IPMI_USERID}" != "" ]
+ then
+ msg -n "Setting username ${IPMI_USERNAME} for user ${IPMI_USERID} " \
+ ipmitool user set name ${IPMI_USERID} ${IPMI_USERNAME}
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+ msg -n "Setting password for user ${IPMI_USERID} "
+ ipmitool user set name ${IPMI_USERID} ${IPMI_PASSWORD} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+
+ msg -n "Setting ADMIN privileges for user ${IPMI_USERID} on channel ${IPMI_LANCHANNEL} "
+ ipmitool channel setaccess ${IPMI_LANCHANNEL} ${IPMI_USERID} link=on ipmi=on callin=on privilege=4 \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+
+ msg -n "Enabling user ${IPMI_USERID} "
+ ipmitool user enable ${IPMI_USERID} \
+ >> /tmp/stdout.log 2>> /tmp/stderr.log
+ ok_or_fail "$?"
+ fi
+
+ fi
+ fi
+}
+
#clone_fatal_error "Failed to sync node data from server!"
fi
- header "Getting node netconfig settings"
- msg -n "Getting data from ${_server} for ${_node}"
+ header "Getting node settings"
+ msg -n "Getting network configuration from ${_server} for ${_node}"
server_get_netcfg "${_node}"
ok_msg
+
+ header "Getting ipmi settings"
+ msg -n "Getting ipmi configuration from ${_server} for ${_node}"
+ server_get_ipmicfg "${_node}"
+ ok_msg
fi
fi