Fetching deploy tasks in iPXE Menu
-
Hello!
I’m trying to image a lot of computers automatically using FOG. My goal is to streamline the process as much as possible.
I believe the best approach is to use Quick Registration with QUICKREG AUTOPOP enabled. This would allow me to register all the computers into one common group, and then start a multicast task to image all the computers in that group afterward.
However, I’m facing a problem. After Quick Registration, the computers go to the iPXE menu and wait for a selection or a timeout. During this time, FOG doesn’t automatically fetch any tasks from the server. To start the imaging process, I have to manually reboot the computers.
I want to avoid having to manually reboot each computer. Is there a way to do this automatically?
May be I should add an advanced menu option that either remounts the FOG image or reboots the computer, and set that option as the default with a short timeout? Which Boot options and parametrs should I use?
-
@kbats183 I haven’t looked at the quick registration bit of code but I did have a hack that updated the fog.auto.reg (full registration) option to begin imaging right after registration without a reboot. This involved taking the FOG supplied script updating it to your requirements and then adding a bit of code onto the end and then finally dynamically patching that script on every boot of the target system. It sounds like a lot of steps and its complicated but not if you know how fog works.
I should be able to point you in a direction so you can get started.
When FOG Linux (the os that gets transferred to the target computer for imaging) boots it runs the master fog script stored in the /bin directory in FOS Linux. The scripts bits of that /bin directory is here: https://github.com/FOGProject/fos/tree/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin The file you are interested in is called fog.auto.reg. If you can understand bash script programming you can modify this file to fit your requirements. Once you have the script the way you need it then you can dynamically patch when FOS linux boots using this tutorial (understand this tutorial is for patching fog.man.reg but the concenpt is the same only the file name changes.
https://forums.fogproject.org/topic/13500/dynamically-patching-fos-using-a-postinit-script
I have tutorials that are targeting the manual registration but the concepts are similar. (hint: this is where I tweak the script to give me a custom calculated host name kind of like the auto naming but better. )
https://forums.fogproject.org/topic/14278/creating-custom-hostname-default-for-fog-man-regSo that’s the background, how do I make it image right after rebooting?
For the fog.man.reg file you append a bit of code that makes the script think the system rebooted and collects the latest imaging info.
(For the life of me I can’t find that tutorial I created but here is the script that I collected from a recent issue with the code in the script.sysuuid=$(dmidecode -s system-uuid) sysuuid=${sysuuid,,}switch mac=$(getMACAddresses) base64mac=$(echo $mac | base64) token=$(curl -Lks --data "mac=$base64mac" "${web}status/hostgetkey.php") curl -Lks -o /tmp/hinfo.txt --data "sysuuid=${sysuuid}&mac=$mac&hosttoken=${token}" "${web}service/hostinfo.php" -A '' curl -Lks -o /tmp/hinfo.txt --data "sysuuid=${sysuuid}&mac=$mac" "${web}service/hostinfo.php" -A '' [[ -f /tmp/hinfo.txt ]] && . /tmp/hinfo.txt . /bin/fog.download
In the case of fog.man.reg this code would be added at the very end of the script.
Looking at the fog.auto.reg script I would say it should go at the very end of that script too.
ref: https://forums.fogproject.org/topic/17601/deploy-image-right-after-registration-without-a-reboot/3
ref: https://forums.fogproject.org/topic/16378/start-imaging-right-after-the-full-host-registration-without-reboot-possible