Add Full Inventory Task to PXE Menu
-
@george1421 adding the space after the boot|| has gotten me farther now.
Now it is displaying Attempting to check in …Failed
Invalid MAC Address! (in line for ) -
@flareimp I didn’t want to confuse the subject so I didn’t initially include this.
When you schedule an inventory task this is the call to launch the FOS Linux client.
#!ipxe set fog-ip 192.168.50.53 set fog-webroot fog set boot-url https://${fog-ip}/${fog-webroot} set storage-ip 192.168.50.53 kernel http://192.168.50.53/fog/service/ipxe/bzImage32 loglevel=4 initrd=init_32.xz root=/dev/ram0 rw ramdisk_size=275000 web=https://192.168.50.53/fog/ consoleblank=0 rootfstype=ext4 mdraid=true mac=00:00:00:87:c2:09 ftp=192.168.50.53 storage=192.168.50.53:/images/dev/ storageip=192.168.50.53 osid=9 irqpoll hostname=00000087c209 mode=inventory deployed=1 mdraid=true imgfetch http://192.168.50.53/fog/service/ipxe/init_32.xz boot
What we are doing is simulating that call via an iPXE menu. I discarded the parameters above that shouldn’t be needed for a hardware inventory. I may have discarded too many. So I do see it passing the mac address during this invocation. Understand what we are doing is not using FOG as it was intended. It should work by YMMV.
So lets tweak the last command I gave you by adding in the mac address (there is room for this command it get it wrong if you have multiple nic adapters in the computer).
:fog.custom.inventory kernel bzImage loglevel=4 initrd=init.xz root=/dev/ram0 rw ramdisk_size=275000 web=${boot-url}/ consoleblank=0 rootfstype=ext4 storage=${fog-ip}:/images/ storageip=${fog-ip} loglevel=4 mac=${net0/mac} mode=inventory deployed=1 imgfetch init.xz boot|| goto MENU
-
@george1421 after adding your changes to the config now it is showing the hostname and mac but saying no task found. So would the next step be adding a command to create and start the inventory task?
-
@flareimp So it looks like this route isn’t possible to perform an immediate inventory since a task needs to be deployed on the FOG server. This appears to not be target computer driven. Sorry I should have tested it in my lab first. I know when you run a registration from the iPXE menu it also sends an inventory to the FOG server and that is target computer driven.
-
@george1421 If I have a host that is not registered in fog and I choose to run the Full Inventory task from the PXE menu, can’t we do something similar to that with hosts that are already registered? I do remember back in the Fog .32 days it was possible.
Thanks for all your assistance!
-
@flareimp said in Add Full Inventory Task to PXE Menu:
can’t we do something similar to that with hosts that are already registered? I do remember back in the Fog .32 days it was possible.
This was my initial thought as the inventory was driven by the client computer. But as we just confirmed this is no longer the case with FOG 1.5.9. With 1.5.9 a task has to be running on the fog server to start the inventory process.
Does your environment use the FOG Client? If so that should also perform an inventory on some interval.
-
@george1421 Yes, all my computers are using the fog client, the issue is we are not allowed to set PXE as the first boot option, has to be the hard drive, so it negates the feature. I was just thinking instead of giving our Interns/temp help access to fog and starting inventory tasks from the web gui it would just be faster to PXE boot a computer and select “run inventory”.
-
@flareimp said in Add Full Inventory Task to PXE Menu:
now it is showing the hostname and mac but saying no task found.
I have to say that I never tried this myself yet and I am not really sure why inventory works when run with the full registration (AFAIK not a task) but otherwise needs a task scheduled. I might find some time to check this out on Friday.
Would using the FOG API be of any help for you? You could schedule inventory tasks with that. Though someone would still need to manually PXE boot the machine.
I don’t think we have inventory updates through the fog-client yet. It’s been discussed on github but is a little more complex as we’d want to have it work on Windows, Linux and Mac OS X.
-
@FlareImp I just played with this stuff and seem to be able to update the inventory of a host through the custom iPXE menu using this as parameter:
kernel bzImage loglevel=4 initrd=init.xz root=/dev/ram0 rw ramdisk_size=275000 web=${boot-url}/ consoleblank=0 rootfstype=ext4 mac=${mac} storage=${fog-ip}:/images/ storageip=${fog-ip} loglevel=4 mode=inventory imgfetch init.xz boot || goto MENU
This is very close to what @george1421 came up with but I removed the
deployed=1
parameter at the end of the kernel line because that would make the inventory task to try and check in (NFS mount, task list and so on) though this is not needed for a simple inventory.EDIT: Though it seems to do the inventory update the entries in the DB don’t get updated yet. I will take a look at why this is not working.
EDIT2: Needed to addmac=${mac}
parameter to make it work, updated parameter code above should work now. Note this is the first MAC address found by iPXE (same as variable${net0/mac}
). You might need to add some more logic in the iPXE code if you have more than one network adapter in some of your hosts and the inventory update does not work. -
@sebastian-roth Thank you and @george1421 for your assistance it this matter. It worked great!
Thanks again and keep up the great work!