pxe

Deploy OpenStack host with Ironic and Redfish

Define node variables

NODE=com4-dev
NODE_BMC_HOST=com4-dev.ipmi.dev.i.example.com
NODE_MAC_NIC1=00:11:22:33:44:55

Define env variables

NODE_BMC_USER=ADMIN
NODE_BMC_PASS=ADMIN

Create now node with Redfish (pxe device boot broken)
https://docs.openstack.org/ironic/latest/admin/drivers/redfish.html

openstack baremetal node create \
  --name ${NODE} \
  --driver redfish \
  --driver-info redfish_address="https://${NODE_BMC_HOST}" \
  --driver-info redfish_username=${NODE_BMC_USER} \
  --driver-info redfish_password=${NODE_BMC_PASS} \
  --driver-info redfish_verify_ca=false \
  --driver-info redfish_system_id=/redfish/v1/Systems/1

Create now node with IPMI
https://docs.openstack.org/ironic/latest/admin/drivers/ipmitool.html

openstack baremetal node create \
  --name ${NODE} \
  --driver ipmi \
  --driver-info ipmi_address=${NODE_BMC_HOST} \
  --driver-info ipmi_username=${NODE_BMC_USER} \
  --driver-info ipmi_password=${NODE_BMC_PASS} 

iPXE
https://docs.openstack.org/ironic/latest/admin/interfaces/boot.html#pxe-boot

ironic / bifrost

# load env
. /opt/stack/bifrost/env-vars

# list nodes
ironic node-list

# remove / shutdown existing node
ironic node-set-provision-state foo.example.com deleted

# load node configuration
export BIFROST_INVENTORY_SOURCE=/opt/openstack-prepare-baremetal/bifrost/json/foo.example.com.json

# add new node
ansible-playbook -i inventory/bifrost_inventory.py enroll-dynamic.yaml
ironic node-update foo.example.com add properties/capabilities='boot_mode:uefi'

# deploy
ansible-playbook -v -i inventory/bifrost_inventory.py deploy-dynamic.yaml

# show node details

Auto update Ubuntu PXE files

Update script
<?php
$URL="https://raw.githubusercontent.com/panticz/preseed/master/pxe/scripts/update.ubuntu.pxe.files.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Create cronjob
<?php
$URL="https://raw.githubusercontent.com/panticz/preseed/master/pxe/scripts/update.ubuntu.pxe.files.cronjob";
echo "wget $URL -O - /etc/cron.d/update.ubuntu.pxe.files.cronjob; chmod a+x update.ubuntu.pxe.files.cronjob";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Configure PXE
wget https://installit.googlecode.com/hg/preseed/preseed.precise.i386.conf -O /var/lib/tftpboot/pxelinux.cfg/preseed.precise.i386.conf
wget https://installit.googlecode.com/hg/preseed/preseed.precise.amd64.conf -O /var/lib/tftpboot/pxelinux.cfg/preseed.precise.amd64.conf
wget https://installit.googlecode.com/hg/preseed/preseed.quantal.i386.conf -O /var/lib/tftpboot/pxelinux.cfg/preseed.quantal.i386.conf
wget https://installit.googlecode.com/hg/preseed/preseed.quantal.amd64.conf -O /var/lib/tftpboot/pxelinux.cfg/preseed.quantal.amd64.conf

vi /var/lib/tftpboot/default
MENU SEPARATOR
MENU BEGIN
MENU TITLE + Preseed
MENU INCLUDE pxelinux.cfg/preseed.oneiric.i386.conf
MENU INCLUDE pxelinux.cfg/preseed.oneiric.amd64.conf
MENU INCLUDE pxelinux.cfg/preseed.precise.i386.conf
MENU INCLUDE pxelinux.cfg/preseed.precise.amd64.conf
MENU INCLUDE pxelinux.cfg/preseed.quantal.i386.conf
MENU INCLUDE pxelinux.cfg/preseed.quantal.amd64.conf

MENU SEPARATOR
LABEL Back
MENU EXIT
MENU END

PXE Net Boot

tftpboot
Memtest86 - http://www.memtest86.com/
Memtest86+ - http://www.memtest.org/
GoldMemory - http://www.goldmemory.cz/

/tftpboot/pxelinux.cfg/default
default - http://www.goldmemory.cz/

Debian PXE Instalation
Sources - http://people.debian.org/%7Ejoeyh/d-i/images/daily/netboot/

Kernel Boot Parameters
vga=791 - set screen resolution to 1024x768
noapic - disable APIC support (on broken motherboards)
textonly - boot to console

update pxelinux.0
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/