Auto registration for unregistered hosts with Quick registration and invetory
-
I want to ask if there is a simple way to not continue booting but select Quick registration and invetory from menu automatically for unregistered hosts only and if possible shutdown after this. Advanced menu? How? I know there is an option for importing csv file, but its just room for errors with obtaining and saving mac address…
We will be installing 150 new computers and I want use fog, and have them all registered for future use. My idea was connect few of them at one time, register them and after registration assign to “upload” group and upload prepared image. I found some options in fog settings for auto naming and image assigning, which is great, but I would like to make this more automatic.
-
Hmmm, interesting question! Concerning the default menu entry it depends on your FOG version. With 1.2.0 you’ll have to edit ‘/var/www/fog/lib/fog/BootMenu.class.php’. Find a like of code looking like this:
[CODE]$this->defaultChoice = “choose --default fog.local --timeout $timeout target && goto ${target}\n”;[/CODE]
Just change ‘fog.local’ to ‘fog.reginput’ (full registration) or ‘fog.reg’ (quick registration)… Save the file and boot your clients.With never FOG versions you can just configure the default entry in the web interface (iPXE Menu).
I was thinking about automating your 150 new clients too. Do you buy them brand new? You probably will have to configure each and every client by hand to make it boot from network anyway, right?? If yes, you can just let it do the (quick registration) after you configured the BIOS settings…
If they are all configured to boot from network already then you could start them one at a time (in that order you want them to be). Have your DHCP server assign IPs from a Pool at this stage. You’ll see all MAC addresses in the log file on the DHCP server. Or if you don’t want to configure a DHCP server just yet you could also use ‘tcpdump’ to capture DHCP requests and get the MACs from there. A little shell scripting can then extract those MAC addresses and generate CVS to import into FOG. We should be able to help you with that if you need assistence…
-
Thanks. No problem to editing some php code, but wanted to avoid this kind of customization for future fog updates (they probably overide this). But will, if I dont find other solution. I thought about this when I realised the boot menu is generated by php, but dont known the system yet. So great to pointing me to right class and code.
Regarding the computers, they will be refurbished and they will be (should be) set up to boot from network and without need to connect keyboard (as we asked for this).
Extracting MACs from log file is option, but for me problably most complicated. But when the script is done and functional, at least the possibility of error will be lower (agains manually recording it).
-
I can help you with the scripting. Do you prefer setting up a DHCP server (which you will need at some point anyway) or capturing the MAC addresses via tcpdump (you’d need a capture PC)??
Either way is a bit of extra work. DHCP pool setup or tcpdump capture, your choice… The good thing about the tcpdump solution is that you can use a laptop and walk from PC to PC, connect it straight to your laptop, capture boot it, wait for the DHCP request and off to the next…
On the other hand editing the boot menu and quick registrating all of them seems even less work. Which ever you choose it would be wise to follow some kind of order.
By the way, do you want to use random dynamic IPs (DHCP range) or static IPs assigned by your DHCP server?
-
I think the simplest solution will be edit the php code. Thanks for offering a help, if I’ll need something I’ll use it.
-
or, you could enable Fog quick registration
fog configuration > fog settings > fog quick registration -
I guess I’m not understanding what you’re trying to do.
-
[quote=“Junkhacker, post: 43692, member: 21583”]or, you could enable Fog quick registration
fog configuration > fog settings > fog quick registration[/quote]
I count on it. But as I understood, quick registration only helps with naming, assigning image to registering hostsetc… But you must register host normaly (choose one of registration option from FOG boot menu, manualy register it on web page, etc…) Or am I mistaken? -
[quote=“Tom Elliott, post: 43696, member: 7271”]I guess I’m not understanding what you’re trying to do.[/quote]
I thought I explained it well, guess not… Simply - I want register (and deploy image to) 150 new computers without need to plug every one of them to keyboard and monitor and I want it do quickly as possible when they arrive. My idea was to plug them few at the time to power and network, boot them, they automaticaly register to FOG with inventory info, they shutdown. I add these computers to one “deploy” group , add task to this group to deploy image, power on computers, let it do its works move them to “finished” group and repeat.I wanted do this with clonezlilla as we did it before, but I like the idea of have them registered, with invetory, have multiple different images ready for them when needed… So I started playing with FOG.
-
I think that’s easily done in the current SVN revision.
The newer revisions actually have a web GUI for editing the boot menu to your liking, including just quick-registering clients that aren’t registered. That’s probably the most common use for it.
-
[quote=“mrzo, post: 43743, member: 28859”]I count on it. But as I understood, quick registration only helps with naming, assigning image to registering hostsetc… But you must register host normaly (choose one of registration option from FOG boot menu, manualy register it on web page, etc…) Or am I mistaken?[/quote]
from the pop up description on this setting [CODE]Enable FOG Quick Registration auto population feature (0 = disabled, 1=enabled). If this feature is enabled, FOG will auto populate the host settings and automatically image the computer without any user intervention.[/CODE]
-
I don’t only read this information, but I also tried it. Not sure how it should work, but with Quick Registration configured, result was, when I booted targeted computer, FOG boot menu showed, and after few seconds computer booted back to OS on harddrive. When I manually choosed Quick registration and inventory from menu, host was registered with proper name given by settings, image was associated etc… But my interaction was needed. That is why I asked about possibility to choose Quick registration automaticaly from menu. This is for FOG 1.2.0 (I tried install trunk version also, but was not able to access FOG configuration page, so I did go back to 1.2.0) Am I missing something?
-
Sorry for the wall in advance. I actually was looking for this feature myself, looked at the Quick Registration Auto Population but found it didnt auto reg if something wasnt registered. I eventually figured it out and made the modification myself. If someone could provide some feedback on this, that would be great. Basically what I did was use the Host Is Valid check to make an if statement to choose between to variable = “” statements. This was all done in the BootMenu.class.php file right at line 138, might be different for you, I have FOG 1.2.0. This does require Auto Population to be turned on and configured to your specifications so as to properly fill out the sequential naming.
Attached is a screenshot of what it looks like for me. I’m sure this could be more appropriately coded, but I’m not the best at php.
TOM, If this isn’t already included, maybe we could add this and give it an on/off button in the webui?
Note: “DESTRUCTIVE: This will forcefully register and image ANY computer that is booted via PXE and isn’t already registered. I do not recommend this at all for a production network. Use with caution in a secure deployment network.”
[PHP]
####Add this
if ($this->Host && $this->Host->isValid()){
$defchoice2 = “choose --default fog.local --timeout $timeout target && goto ${target}\n”;
}ELSE{
$defchoice2 = “choose --default fog.reg --timeout $timeout target && goto ${target}\n”;
}
####Don’t touch thisif ($Advanced) $this->pxemenu['fog.advanced'] = 'Advanced Menu'; $this->memdisk = "kernel $memdisk"; $this->memtest = "initrd $memtest"; $this->kernel = "kernel $bzImage root=/dev/ram0 rw ramdisk_size=$ramsize ip=dhcp dns=$dns keymap=$keymap web=${webserver}${webroot} consoleblank=0 "; $this->initrd = "imgfetch $imagefile\n";
####Modify this
$this->defaultChoice = “$defchoice2”;
####[/PHP][url=“/_imported_xf_attachments/1/1788_Screenshot 2015-03-15 14.17.35.png?:”]Screenshot 2015-03-15 14.17.35.png[/url]
-
This already exists for dev fog.
-
Ahh, OK. I probably didn’t look hard/long enough. I am really good at missing information that’s right in front of me. I just got started with FOG last week and I must say I’m thoroughly impressed with it.
-
So, the solution could be install the trunk version?
-
In as simple terms as possible, yes!
-
Is it possible to shutdown computer after auto populating with given image instead of restarting (and booting from HD)?
-
It should be possible to customize your fog to allow for this but its not settable in fog you would have to see how the web gui does it when you manually deploy an image and check the shutdown after task box.
-
Have som problems with Fog - some computers don’t register correctly and when I checked the database, the host is registered with hostID 0 - related MAC address is in the table hostMAC (with hostID 0) but host is not showing in hosts list, and is not recognised as registered. Using older trunk version 3153.
When I manualy delete these two records from database, host register correctly. I have only two PC with thos problem and dont know why these two.