Reprovisioning bare metal Linux servers with Foreman and IPMI

September 25, 2019 

Recently we had to reprovision a bare metal server that was in Foreman and had IPMI support. The goal was to check if our automated "force-join to FreeIPA domain after reprovisioning" logic worked as intented. We did not have access to any graphical IPMI console, nor Foreman's GUI, so we had to do everything from the command-line. The host we reprovisioned was a CentOS 7 instance. It is assumed that IPMI tools are installed. This post was inspired by the Automate SuperMicro Server Provisioning or Die Trying blog post.

First make sure that Foreman is configured to reprovision the host on PXE boot:

$ hammer host update --name <hostname> --build 1

This removed the Puppet certificate for the node and marks it as "to be reprovisioned" in Foreman.

Then, on the to-be-provisioned host itself, use ipmitool to force PXE booting for the next reboot:

$ ipmitool chassis bootdev pxe
Set Boot Device to pxe

Then (hard) reboot using IPMI:

$ ipmitool -I open chassis power cycle

You can monitor /var/log/foreman/production.log to see what is happening.

Samuli Seppänen
Samuli Seppänen
Author archive
menucross-circle