Automatically Reimage on Reboot

  • Hello all,

    I was wondering if it was possible to set up FOG in a way that every time a host reboots it fog will reimage the host.

    I have been thinking about how to get this to work and some of my ideas are below:
    Periodically add tasks (for reimaging a host) to the queue so that there is always a task ready for when the host reboots.

    On the FOG server, determine when a reimage task has been completed and then create a new task for the host that has just been reimaged

    If you think any of these solutions are plausible or have a better one I would love to hear about it.

  • Thanks! I’ll start working on that, and I’ll let you know if it works or if I run into any other problems.

    Thanks again!

  • You may have to setup a logout script on the system then. Have that script generate the task for you automatically.

    Basically you would need to be able to use MYSQL and FTP. Get a copy of the PXE Task Generated file and place that (via FTP) on the FOG Server in the location: /tftpboot/pxelinux.cfg/

    The MYSQL you would need should contain something along the lines of:
    [code]INSERT INTO tasks (taskHostID,taskStateID,taskTypeID,taskNFSGroupID,taskNFSMemberID) VALUES (‘XX’,‘1’,‘1’,‘1’,‘1’)[/code]

    Of course the XX change the hostID to be that of that particular host.

  • Hello,

    Sorry for the extremely late reply. I had quite a few incidents come up and I completely forgot about this thread.

    I would like to re-image the system each time because I am using it as a physical sandbox. I would like to be able to run a malicious sample on the machine for analysis then afterwards re-image it in order to return it to a clean state.

    I don’t believe I use the FOG Client as I did not explicitly install it. I do not want to manually create a new task each time as I would like the process streamlined and automation would be best as it isn’t possible to know when or how often a task will be needed.

  • The question have, before delving into this concept, is why would you need a system to be re-imaged every reboot?

    Obviously you feel the need, but I’d just like to understand the why. Wouldn’t this mean you’d constantly need to make sure the image is up to date? Also, do you use the FOG Client on the systems?

    If you do use FOG Client, I don’t know how good it will be to do such a thing as the FOG Client (unless you turned it off) will reboot a system if it finds a non-snapin task for the client.

    Does it really have to be re-imaged on every reboot? If not, why not setup a scheduled task that repeats at the same time everyday, or as often as you need it to?