• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Triggering image deploy through url.

Scheduled Pinned Locked Moved
General
api api help fogapi-psmodule automation
3
4
735
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    r.pawlowski
    last edited by JJ Fullmer Mar 31, 2023, 7:37 AM Jul 22, 2022, 8:07 AM

    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.

    1. Through Web Interface we choose Bios for device and image id
    2. Arduino is setting BIOS
    3. Computer reboots and boots via network.
    4. 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 ?
    G 1 Reply Last reply Jul 27, 2022, 11:33 AM Reply Quote 0
    • G
      george1421 Moderator @r.pawlowski
      last edited by Jul 27, 2022, 11:33 AM

      @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.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      R 1 Reply Last reply Aug 1, 2022, 12:17 PM Reply Quote 0
      • R
        r.pawlowski @george1421
        last edited by r.pawlowski Aug 1, 2022, 6:19 AM Aug 1, 2022, 12:17 PM

        @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.

        J 1 Reply Last reply Aug 1, 2022, 3:25 PM Reply Quote 0
        • J
          JJ Fullmer Testers @r.pawlowski
          last edited by Aug 1, 2022, 3:25 PM

          @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.

          Have you tried the FogApi powershell module? It's pretty cool IMHO
          https://github.com/darksidemilk/FogApi
          https://fogapi.readthedocs.io/en/latest/
          https://www.powershellgallery.com/packages/FogApi
          https://forums.fogproject.org/topic/12026/powershell-api-module

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          1 / 1
          • First post
            2/4
            Last post

          160

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project