Triggering image deploy through url.
-
Hi, I have a question. I will outline what our plan is. We are deploying image on many machines sometimes even up a 100 a week. We are looking for a solution to speed up the process. We came up with an idea. We are going to set up Arduino which is going to change BIOS settings ( enable network boot, ect) and at the end is starting boot from network and triggering fog server to get chosen image to deploy. In the past with help from @george1421
we did implement “Hands off Fog deployment” which could be enough we have to go to the menu settings type proper image id and all is ready to go but we want to set up Arduino, create web interface to have some type of control over it, because they are different type of BIOS and we to have a list to choose from for Arduino and we want through web trigger image deploy with Image id we want.- Through Web Interface we choose Bios for device and image id
- Arduino is setting BIOS
- Computer reboots and boots via network.
- Image with Id form point nr 1 is deployed
- My question is can we trigger fog through URL ?
- We could also ssh server and trigger fog server localy ?
- Or maybe there is better way to do this ?
-
@r-pawlowski You may be able to do this using the FOG API. I have not personally worked with the API but there is some info about it here: https://forums.fogproject.org/topic/12026/powershell-api-module
@JJ-Fullmer might be able to expand a bit on it if prompted.
-
@george1421 Thanks, I didn’t know “FOG” has api. I will check that out.
@JJ-Fullmer Lovely, if I need some help I prompt you
I need to get to know Api and see what I can build on that. -
@r-pawlowski I would be happy to help in anyway I can. Personally, I deploy a bootmanager (grub2win) and the ipxe.efi file to each machines efi partition. Then I can just change the boot managers default to boot straight to fog. It takes a bit of time to get setup, but I found it to be the most reliable as I then didn’t have to worry as much about the bios settings. Theoretically you can use bcdedit commands to change the boot order to boot to network, but that also differs on different hardware.
I digress though, the easy bit for queueing an image to deploy
- Follow the setup instructions for the fog API (involves installing the module from powershell gallery and then inputting your API keys and fog server address)
- Then make sure the host you’re imaging is assigned the correct image, this can be changed in the API if you need that, but for this quick example, we’ll pretend it’s set correct.
- For an example, we’ll say the hostname of a computer in fog is ‘test-computer’, so this will find the host in fog, then queue an image to deploy on it right now
$hostID = (Get-FogHost -hostname 'Test-Computer').id #create a quick json string, this can also be done in a powershell object and converted, but this is just a quick example. #tasktypeID of 1 is a deploy task, if no runtime/schedule time is specified, it defaults to instant deploy # shutdown = 0 is not scheduling with shutdown # I believe other2 = 0 means not a debug # other4 = 1 means to enable wol # isactive =1 means the task is active $jsonData = "{`"taskTypeID`": 1,`"shutdown`":`"0`",`"other2`":`"0`",`"other4`":`"1`",`"isActive`":`"1`" }"; # make the API call to create the new task for your host New-FogObject -type objecttasktype -coreTaskObject host -jsonData $jsonData -IDofObject $hostId;
Once you have this all setup in a powershell module or script internally, you can get things automated pretty smoothly. It’s meant to be modular so it can be applied to any infrastructure or workflow and built upon.
If you need more help let me know and I’ll see what I can do.