Autodeploy a default image without any intervention (pressing Enter) - for non-registered hosts



  • I know this won’t be an issue with registering a host, but we deploy images at sites then ship them out. Likely never to show up again. So, often have dozens of machines new out of box to get imaged 1 time at our main office. Utilizing KVM and numerous other station setup benches it would be nice to not have to still press Enter with “Deploy Image” for 10 machines or so at a time.

    I am running 1.5.9-RC2.9
    I have fog.deployimage set as the Default Item, for Not Registered Hosts.
    I have replaced login under “Parameters” with set username [myUsername] set password [myPassword]
    This will then load an image list screen:
    ImageName1 (1)
    ImageName2 (2)
    Return to menu

    At this screen I have to press enter for the Default image (one at the top), even if there is no other image. I would like for it to just auto select the top/default image and continue on with deploying.

    I found this topic: https://forums.fogproject.org/topic/9209/autodeployment-default-image-fog-1-30/2
    But it doesn’t outline how to get it to be fully automated. The OP on that topic specified changing out param qihost 1 though I’m not sure with what.

    I also found this topic: https://forums.fogproject.org/topic/12244/deploy-associed-image-on-boot-menu
    However that gives another error when disabling (unchecking) “Image List Menu” under “FOG Boot Settings”. It will load up the Deploy Image menu option, but then state:
    “Host is not valid, host has no image assigned, or there are no images defined on the server.”

    I’m not sure what I’m missing, but the goal is to have the ability to image new computers once without any need to intervene at the keyboard (aside from booting to PXE) and do not need them registered as they get shipped out to another location after being imaged and setup.



  • That’s a bingo.

    However I found this topic: https://forums.fogproject.org/topic/13172/how-to-create-a-fog-ipxe-menu-entry-that-deploys-a-specific-image
    A nicer representation with of args through pictures. That topic does go into creating a new iPXE menu entry, which is what I plan to do in preventing fog.deployimage from getting mucked up.

    Oh this topic too: https://forums.fogproject.org/topic/8760/pxe-boot-menu-advanced
    Though it’s a little dated.

    @george1421 you provided some good keywords to help me find those topics.

     

    For those that find this post. The steps to my solution:

    • Use the link george provided, though you don’t need mac:
      http://<fog_server_ip>/fog/service/ipxe/boot.php?qihost=1&username=<fog>&password=<password>&imageID=<image_id>
    • To get a better understanding of what you are copying and what is all defined and how they are reprosented read this post:
      https://forums.fogproject.org/topic/13172/how-to-create-a-fog-ipxe-menu-entry-that-deploys-a-specific-image
    • In your iPXE menu Parameters text box you just need the long line that starts with kernel making sure to replace bzImage32 with bzImage and init_32.xz with init.xz
      Next line: imgfetch init.xz
      Then boot as the last line

    Thanks again for the help @george1421


  • Moderator

    @drumnj said in Autodeploy a default image without any intervention (pressing Enter) - for non-registered hosts:

    @george1421 said in Autodeploy a default image without any intervention (pressing Enter) - for non-registered hosts:

    The system would then basically be in autopilot mode and deploy an image without any human intervention to say, “yes lets really do that”.

    What’s wrong with that. It’s in house for our IT staff to use and only setup when imaging a large amount of machines at once. Anything that accidentally runs PXE would still format in an environment where we want it to format.

    While it isn’t my concern but inadvertantly imaging a computer that isn’t intended is one consequence of a fully automated deployment.

    So there is no param to edit/add under fog.deployimage?
    There are no stops in the code once it hits fog.deploy image. Once that script starts the target WILL BE imaged.

    So “Image List Menu” disabled serves no purpose to auto selecting a default image?

    This option was intended to allow the user to reimage his/her computer by only presenting the assigned image to the workstation. This option kept the FOG ui from presenting all loaded images to the user via the deploy image ipxe menu.

    Would Non-Registered Host Image be of any use?

    The deploy image image list menu disable only works for registered images.

    In your case you want to operate as a MSP and use the load and go concept. In that you pick an image to deploy from the deploy image menu without needing to register the target computer. This is because once FOG images the computer it may never see it again. You don’t need the management features of FOG.

    Under the concept of you learn more from your mistakes than your successes I’ll give you a few hints on how you might do something similar to what you want with FOG.

    The first learning point is to review this thread (not the entire thread, the first few posts). Look how you can create a custom fog iPXE menu item to load a linux or other live boot image. Pay attention to the kernel and image args and initrd lines. https://forums.fogproject.org/topic/10944/using-fog-to-pxe-boot-into-your-favorite-installer-images

    Once you kind of understand how the iPXE menu works and how you can call unique boot kernels with different parameters then key in the following into your browser can call the following URL changing out the IP address, image ID,username,password parameters (removing the greater than and less than characters too) that are appropriate for your install.

    http://<fog_server_ip>/fog/service/ipxe/boot.php?mac=00:00:00:00:00:00&qihost=1&username=<fog>&password=<password>&imageID=<image_id>

    You will see something familiar with what is returned. Just replace bzImage32 with bzImage (watch case) and init_32.xz with init.xz and merge what you know and what you have learned from the first link into a new iPXE menu. PXE boot and see what happens.

    Understand the url will extract what is needed from the database. If you make changes to the image settings in the UI after you create the iPXE menu the ipxe will not change.



  • @george1421 said in Autodeploy a default image without any intervention (pressing Enter) - for non-registered hosts:

    The system would then basically be in autopilot mode and deploy an image without any human intervention to say, “yes lets really do that”.

    What’s wrong with that. It’s in house for our IT staff to use and only setup when imaging a large amount of machines at once. Anything that accidentally runs PXE would still format in an environment where we want it to format.

    So there is no param to edit/add under fog.deployimage?
    So “Image List Menu” disabled serves no purpose to auto selecting a default image?
    Would Non-Registered Host Image be of any use?


  • Moderator

    @drumnj said in Autodeploy a default image without any intervention (pressing Enter) - for non-registered hosts:

    At this screen I have to press enter for the Default image (one at the top), even if there is no other image. I would like for it to just auto select the top/default image and continue on with deploying.

    To do this it would take a little (re)programming (on your part) of the boot.php script on the fog server. Because you are still in the iPXE menu structure at this point doing what you want is possible.

    But thinking about it, is it really practical? You are defaulting into the deploy image menu. The only thing stopping you from actually pushing out a new image to a target computer once you pxe boot is this image selection menu. What would happen if someone pxe booted by mistake. The system would then basically be in autopilot mode and deploy an image without any human intervention to say, “yes lets really do that”.

    To look at it a different way, you “could” create a Deploy image X and Deploy image Y iPXE menu that would basically bypass all of the deploy image controls and need no programming of the FOG backend system.


Log in to reply
 

296
Online

7.2k
Users

14.4k
Topics

135.6k
Posts