My setup has one head node which hosts a bootable image, which many compute nodes PXE boot from using grub. The issue is because of the varying hardware of the various nodes, I need different grub configurations (to load different images) to different clients.
First, I tried this. My network has all nodes with lets say configuration “A” under the IP range 10.0.1.1-10.0.15.255, and configuration “B” in the range 10.0.16.1-10.0.31-255. I tried creating the files
grub.cfg-0A001, respectively, but it seemed to load the default grub.cfg anyway.
Then, I tried using the variable $net_default_ip and the
regexp command to determine which ip range the node is located in, and set a default menu item based on that. The issue is, there is next to no documentation about this command that I could find. I tried using a standard POSIX regex syntax:
if regexp /10\.0\.1\.1/gx;, but this conditional seems to return true every time, and the default menu item is simply my last if statement. Creating individual if statements for each node works:
if [ "$net_default_ip" = "10.0.1.1" ];, however, I would prefer not to go this route because of the amount of nodes that this would have to be done for, not to mention new nodes that would be added in the future.
Any help would be greatly appreciated, I’m at a loss at this point.