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

    Can I use some kind of script to create image and ghost my lab machines

    Scheduled Pinned Locked Moved Unsolved
    FOG Problems
    8
    36
    14.0k
    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.
    • N
      NayanaAdassuriya
      last edited by NayanaAdassuriya

      Server
      • FOG Version: Latest
      • OS: Centos7
      Client
      • Service Version: What is this?
      • OS: Windows 10
      Description

      I’m using trying to use fog for test automation with Jenkins

      1. So I need a way to ghost machines using a Jenkins job (using some script such as python, bash or batch script).
      2. Secondly I need to create a new image of the current host by running some script in the host. (first I install my product, create image and ghost other machines to reduce the installation failures).

      Someone achieve point 1 and 2, appreciate you assist
      Thank you!

      1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        Right now I am not sure this is possible. I know we are working on having an API level system in the future but as far as one that just works out the box right now is not in place.

        That said, somebody did kind of help provide an similar type system that was based on python. I’m certain it probably doesn’t work right out the gate anymore.

        https://github.com/JC-SoCal/pyFog

        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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • Wayne WorkmanW
          Wayne Workman
          last edited by

          This is possible if we directly interact with the database and certain specific fog web files.

          We can query the DB to get the ID of the host using it’s name, and create a job in the DB. Then, we call the below link to do a WOL.
          http://x.x.x.x/fog/management/index.php?sub=wakeEmUp&mac=aa:bb:cc:dd:ee:ff

          I’ve been planning on doing something like this at my house for automated testing purposes - and I’d be glad to work out the details with you here.

          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!
          Daily Clean Installation Results:
          https://fogtesting.fogproject.us/
          FOG Reporting:
          https://fog-external-reporting-results.fogproject.us/

          1 Reply Last reply Reply Quote 0
          • A
            AndrewG78
            last edited by Tom Elliott

            It is my second post with workaround today 😉
            Here is my working solution to execute deploy task for host with ID=2 from commandline.
            So, Jenkins support is not a problem from now on.
            I used curl with cookies file to achieve that.

            curl -c cookie.txt --request POST --url "http://<your_IP>/fog/management/index.php"  --header "content-type: multipart/form-data"  --form "uname=fog" --form "upass=password" --form "ulang=English" --form "login=Login"
            curl -b cookie.txt --request POST --url "http://<your_IP>/fog/management/index.php?node=host&sub=deploy&id=2&type=1" --header "content-type: multipart/form-data" --form "wol=on" --form "scheduleType=instant" --form "taskhosts[]=2"
            
            Wayne WorkmanW 1 Reply Last reply Reply Quote 0
            • Wayne WorkmanW
              Wayne Workman @AndrewG78
              last edited by

              @AndrewG78 fog has an api now that can do this. I’ll dig up the commands I have as examples.

              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!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              1 Reply Last reply Reply Quote 0
              • A
                AndrewG78
                last edited by

                @Wayne Workman
                Thx, but did I miss some API documentation?
                I was looking for it here and on the wiki, but found nothing.

                1 Reply Last reply Reply Quote 0
                • A
                  AndrewG78
                  last edited by AndrewG78

                  O’right
                  Got it here.
                  https://news.fogproject.org/simplified-api-documentation/
                  Perhaps, it should be included on the wiki…

                  EDIT:
                  Hmmm. I think that it would be nice to have some multicast deployment examples.
                  DOcs are missing this information.
                  I’m getting
                  {
                  “error”: “Invalid tasking type passed”
                  }
                  whilst I use proper ID=8 for multicast

                  1 Reply Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott
                    last edited by

                    I think I want to push the bootstrap branch into the working branch and start getting that tested as well. I know the “GUI” side is totally different from the API side, but I’ve been improving and including new things that to the API side of things as well. As I progress I will likely add in container elements to help refine searches and what not, but I need documentation and I simply cannot do it alone unfortunately.

                    I’ve tried very hard to make the API as basic as possible to ensure it can get maximum exposure with relative simplicity.

                    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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    1 Reply Last reply Reply Quote 0
                    • Wayne WorkmanW
                      Wayne Workman
                      last edited by

                      Cancel all tasks of types 1 or 2
                      
                      curl --silent -X DELETE -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/cancel -d '{"typeID": [1,2] }'
                      

                      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!
                      Daily Clean Installation Results:
                      https://fogtesting.fogproject.us/
                      FOG Reporting:
                      https://fog-external-reporting-results.fogproject.us/

                      1 Reply Last reply Reply Quote 0
                      • Wayne WorkmanW
                        Wayne Workman
                        last edited by

                        Set host IDs 1 2 and 3 to image ID 1
                        
                        curl --silent -k -H 'Content-Type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/image/1/edit -X PUT -d '{"hosts": [1,2,3]}'
                        

                        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!
                        Daily Clean Installation Results:
                        https://fogtesting.fogproject.us/
                        FOG Reporting:
                        https://fog-external-reporting-results.fogproject.us/

                        1 Reply Last reply Reply Quote 0
                        • Wayne WorkmanW
                          Wayne Workman
                          last edited by

                          Get task status of host ID 1
                          
                          curl --silent -X GET -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/active -d '{"hostID": [1]}'
                          

                          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!
                          Daily Clean Installation Results:
                          https://fogtesting.fogproject.us/
                          FOG Reporting:
                          https://fog-external-reporting-results.fogproject.us/

                          A 1 Reply Last reply Reply Quote 0
                          • Wayne WorkmanW
                            Wayne Workman
                            last edited by

                            Capture image from host id 1
                            
                            curl --silent -k --header 'content-type: application/json' --header 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' --header 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/host/1/task --data '{"taskTypeID":2,"shutdown": true}'
                            

                            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!
                            Daily Clean Installation Results:
                            https://fogtesting.fogproject.us/
                            FOG Reporting:
                            https://fog-external-reporting-results.fogproject.us/

                            1 Reply Last reply Reply Quote 0
                            • Wayne WorkmanW
                              Wayne Workman
                              last edited by

                              Cancel tasks for a single host of ID 1
                              
                              curl --silent -X GET -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/cancel -d '{"hostID": [1]}'
                              

                              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!
                              Daily Clean Installation Results:
                              https://fogtesting.fogproject.us/
                              FOG Reporting:
                              https://fog-external-reporting-results.fogproject.us/

                              A 1 Reply Last reply Reply Quote 0
                              • Wayne WorkmanW
                                Wayne Workman
                                last edited by

                                Deploy an image to a single host with the name testhost1
                                
                                curl --silent -k -H 'Content-Type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/host/testhost1/task -d '{"taskTypeID":1,"shutdown": true}'
                                

                                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!
                                Daily Clean Installation Results:
                                https://fogtesting.fogproject.us/
                                FOG Reporting:
                                https://fog-external-reporting-results.fogproject.us/

                                1 Reply Last reply Reply Quote 0
                                • Wayne WorkmanW
                                  Wayne Workman
                                  last edited by

                                  @AndrewG78 We need volunteers to write some documentation. For the multicasting problem, it may not be implemented into the API yet - I’m not sure.

                                  Here are my example commands I promised:

                                  FOG Server IP in these examples is 10.0.0.28 and the keys you see in here are my test keys on my test server at home. I left them in there so everyone can have a valid example. 1 is the FOG ID of the host in FOG, testhost1 is the hostname.

                                  #wiki worthy

                                  Also pinging @Moderators and @Testers just so they get exposure.

                                  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!
                                  Daily Clean Installation Results:
                                  https://fogtesting.fogproject.us/
                                  FOG Reporting:
                                  https://fog-external-reporting-results.fogproject.us/

                                  1 Reply Last reply Reply Quote 0
                                  • A
                                    AndrewG78
                                    last edited by

                                    HI,
                                    Are there any news regarding API implementation?
                                    I wanted to read changelog of RC versions, but keep getting 502 Bad Gateway.
                                    Andrew

                                    george1421G 1 Reply Last reply Reply Quote 0
                                    • george1421G
                                      george1421 Moderator @AndrewG78
                                      last edited by

                                      @andrewg78 AFAIK no changes have been made to the API since 1.4.4 was released. The 1.5.0 branch has a few minor bug fixes, but was mainly focused on the new web gui.

                                      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!

                                      1 Reply Last reply Reply Quote 0
                                      • A
                                        AndrewG78
                                        last edited by

                                        @george1421 Thank you. I have 1.4.2 . Do you maybe know if there are some changes in API between my version and 1.4.4 ?
                                        https://news.fogproject.org/fog-1-4-4-officially-released/ keeps popping out 502 error

                                        george1421G 1 Reply Last reply Reply Quote 0
                                        • george1421G
                                          george1421 Moderator @AndrewG78
                                          last edited by

                                          @andrewg78 There were some tweaks to the API between 1.4.2 and 1.4.4, but I can’t tell you off the top of my head. You would be better to move to 1.4.4 anyway outside of the API stuff. There were some issues with 1.4.2 that was address in 1.4.3 and finally in 1.4.4.

                                          The developers are still on holiday, but let me see if I can ping one of them to kickstart the news server.

                                          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!

                                          1 Reply Last reply Reply Quote 0
                                          • A
                                            AndrewG78
                                            last edited by AndrewG78

                                            May u please validate my curl command?
                                            I keep getting same error as I mentioned few months ago.
                                            {
                                            “error”: “Invalid tasking type passed”
                                            }

                                            I’m trying to task multicast process.

                                            curl --header “fog-api-token: <token>=” --header “fog-user-token: <token>=” --data ‘{“taskTypeID”:8}’ -X POST http://<IP>/fog/group/2/task

                                            Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            227

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project