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

Passing host variable to iPXE menu

Scheduled Pinned Locked Moved
General
4
18
4.2k
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.
  • D
    dcldn
    last edited by Oct 31, 2017, 12:54 PM

    Hi All

    I have a custom Fog iPXE menu entry to launch a CentOS 7 install with a kickstart file.

    The parameters section of the entry looks like this:

    initrd nfs://nfsserver/path/to/image/x86_64/initrd.img
    chain nfs://nfsserver/path/to/image/x86_64/vmlinuz initrd=initrd.img ramdisk_size=32000 dns=dnsserver ksdevice=link ip=::::myhostname::dhcp ks=nfs://nfsserver/path/to/kickstart/centos_7_kickstart.ks
    boot || goto MENU
    

    This works great, I can launch from the iPXE menu and the CentOS Anaconda installer starts.

    “myhostname” in…

    ip=::::myhostname::dhcp
    

    …is the host name that is passed to the CentOS Anaconda installer.

    Is there a way to pass the Host Name attribute of a registered FOG host (or any FOG attribute for that matter) to this menu.

    I guess I’m wondering if it’s possible to do something like:

    ip=::::${foghost}::dhcp
    

    The goal is to be able to launch the installer and have it configure the host name based on what has been configured in Fog. A bonus would be a custom task I can launch from the Fog Web Gui.

    There are other ways I can assign a hostname when bootstrapping a host (DHCP “host-name” option, a script in the kickstart script etc.) but I’m interested to know if this is achievable through Fog.

    Many thanks in advance for any assistance you can provide.
    David.

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by Oct 31, 2017, 1:09 PM

      I’m not aware that any internal values are available in the iPXE menu, but that would be an interesting feature request.

      I could see value in having the potential to expose:
      hostname
      imagename
      primaryuser
      othertag1
      othertag2

      In the iPXE boot menu. In my limited knowledge it might be pretty easy to do. @Developers opinion??

      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
      • G
        george1421 Moderator
        last edited by Oct 31, 2017, 2:44 PM

        I think I have a hack a solution for you. Its pretty easy.

        What version of FOG are you using?

        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!

        G 1 Reply Last reply Oct 31, 2017, 2:59 PM Reply Quote 0
        • G
          george1421 Moderator @george1421
          last edited by Oct 31, 2017, 2:59 PM

          @george1421 OK if you are using FOG 1.4.4 and are comfortable editing a file in the fog server’s code you can do the following.

          Edit this file with your favorite linux file editor: /var/www/html/fog/lib/fog/bootmenu.class.php

          Jump to line 191 and insert the following code:

          $this->_Host = $Host;
          

          Jump to line 194 and insert the following code:

          sprintf('set targetname %s', $this->_Host->get(name)),
          

          Your patched code should look like this:
          0_1509461646550_bootmenu_hack.png

          Save your edits and then key in the following into your browser http://<fog_server_ip>/fog/service/ipxe/boot.php?mac=<mac_address_of_registered_host> replacing <fog_server_ip> with the real IP address of your fog server and <mac_address_of_registered_host> with a mac address of a known host. If you get a white page with no text then you did something wrong. If you get a bunch of text and at the top there is

          #!ipxe
          set targetname <name_of_host>
          set fog-ip 
          

          Then the edit was successful. At this point you can use ${targetname} in your custom ipxe menu as the representation of the imaging target’s host name as defined in FOG.

          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!

          D 2 Replies Last reply Oct 31, 2017, 3:04 PM Reply Quote 0
          • D
            dcldn @george1421
            last edited by Oct 31, 2017, 3:04 PM

            @george1421

            Hi George, thank you for the quick response and looking into this for me, its much appreciated! I’m on Version 1.3.0, I’m hoping that’s close enough for your solution to work. I’ll give it a try hopefully later today.

            1 Reply Last reply Reply Quote 0
            • D
              dcldn @george1421
              last edited by Oct 31, 2017, 3:45 PM

              @george1421

              Your solution worked perfectly, thank you so much, George!

              The next thing I need to look at doing is a new task type so I can kick off this kickstart install through the Fog web-GUI. I’ve installed the Task Type Management plugin but not sure what to enter in the fields. I’ve had a search but can’t find any documentation on this plugin. Would you be able to point me in the right direction? My menu name is “:CentOS_7_4_vm” so I assume that needs to go in one of the fields. Let me know if you would prefer I start a new post.

              Thanks again

              G 2 Replies Last reply Oct 31, 2017, 4:01 PM Reply Quote 0
              • G
                george1421 Moderator @dcldn
                last edited by Oct 31, 2017, 4:01 PM

                @dcldn Just so I’m clear, You want to… from inside fog launch a task that will instruct the client to install centos? Or do you want to pick that from the iPXE boot menu?

                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!

                G D 2 Replies Last reply Oct 31, 2017, 4:04 PM Reply Quote 0
                • G
                  george1421 Moderator @george1421
                  last edited by Oct 31, 2017, 4:04 PM

                  @george1421 If its the former take a look at this post: https://forums.fogproject.org/topic/10933/fog-upgrade-to-1-5-broke-pxe-installation/7

                  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
                  • G
                    george1421 Moderator @dcldn
                    last edited by Oct 31, 2017, 4:06 PM

                    @dcldn said in Passing host variable to iPXE menu:

                    Your solution worked perfectly, thank you so much, George!

                    The next time I chat with the developers, I’ll ask about making this a “feature” instead of a “hack”. If it is promoted to a feature it will be in the next release (1.5.0 stable [probably]) They won’t back port solutions normally.

                    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!

                    D 1 Reply Last reply Oct 31, 2017, 4:15 PM Reply Quote 0
                    • D
                      dcldn @george1421
                      last edited by Oct 31, 2017, 4:08 PM

                      @george1421

                      I want to click a host (or group of hosts), click the Basic Tasks menu -> Advanced tasks and choose a “Deploy CentOS” task from there which starts the kickstart installation I’ve configured in the iPXE menu. It already works fine from the iPXE menu itself.

                      G 1 Reply Last reply Oct 31, 2017, 4:15 PM Reply Quote 0
                      • G
                        george1421 Moderator @dcldn
                        last edited by Oct 31, 2017, 4:15 PM

                        @dcldn yeah, then look at the link I provided. You will need to do some programming to complete that plugin. It is only a framework. It just so happens that the OP of that thread is doing something similar to what you need. Should there be better FOG documentation, simply yes. If you are willing to contribute, please do once you get it figured out.

                        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
                        • D
                          dcldn @george1421
                          last edited by Oct 31, 2017, 4:15 PM

                          @george1421 said in Passing host variable to iPXE menu:

                          @dcldn said in Passing host variable to iPXE menu:

                          Your solution worked perfectly, thank you so much, George!

                          The next time I chat with the developers, I’ll ask about making this a “feature” instead of a “hack”. If it is promoted to a feature it will be in the next release (1.5.0 stable [probably]) They won’t back port solutions normally.

                          I suspect there are people handing off to a different provisioning solution to handle hostname config etc. for nix hosts. It’s awesome being able to do this through Fog now, particularly in my environment where I have workstations dual booting Windows and Linux.

                          G W 2 Replies Last reply Oct 31, 2017, 4:17 PM Reply Quote 0
                          • G
                            george1421 Moderator @dcldn
                            last edited by george1421 Oct 31, 2017, 10:18 AM Oct 31, 2017, 4:17 PM

                            @dcldn Really the FOG Client for linux should do the same thing, if you image your systems like the windows folks do (create a golden image and then clone from that). Then the fog client will rename the system and install any snapins that you might want. But if you have a working solution run with it until you run into a show stopper. Then realize there are other ways to go about things too.

                            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!

                            D 1 Reply Last reply Nov 1, 2017, 11:59 AM Reply Quote 1
                            • W
                              Wayne Workman @dcldn
                              last edited by Oct 31, 2017, 4:52 PM

                              @dcldn The FOG Client works on Linux: https://wiki.fogproject.org/wiki/index.php?title=FOG_Client

                              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
                              • S
                                Sebastian Roth Moderator
                                last edited by Oct 31, 2017, 6:07 PM

                                @george1421 said in Passing host variable to iPXE menu:

                                The next time I chat with the developers, I’ll ask about making this a “feature” instead of a “hack”.

                                AFAIK the hack is not needed at all if DHCP is properly propagating the hostname to the client within the DHCP answers as iPXE already has config setting hostname. So you should be able to just use ${hostname} (also see here).

                                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

                                G 1 Reply Last reply Oct 31, 2017, 6:53 PM Reply Quote 0
                                • G
                                  george1421 Moderator @Sebastian Roth
                                  last edited by Oct 31, 2017, 6:53 PM

                                  @sebastian-roth I don’t think this is possible here. I think we have the chicken and egg situation here. dhcp knows about the computer’s name because the client tells it during dhcp negotiations. In this case, the client is a new born and doesn’t know enough to tell the dhcp server its name. To get it to work correctly the OP may have to setup dhcp reservations to inform the dhcp server what the client associated with mac address xxxx is.

                                  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!

                                  D 1 Reply Last reply Nov 1, 2017, 12:02 PM Reply Quote 0
                                  • D
                                    dcldn @george1421
                                    last edited by Nov 1, 2017, 11:59 AM

                                    @george1421 said in Passing host variable to iPXE menu:

                                    @dcldn Really the FOG Client for linux should do the same thing, if you image your systems like the windows folks do (create a golden image and then clone from that). Then the fog client will rename the system and install any snapins that you might want. But if you have a working solution run with it until you run into a show stopper. Then realize there are other ways to go about things too.

                                    We currently provision our Linux boxes by bootstrapping with PXE/Kickstart which then hands off to Puppet to do the rest. I like this solution as we’re able to make incremental changes to the workstation estate through Puppet and we know that when we add a new box to the network it will end up with the same state. With that said, I can definitely see the benefits of cloning and it may be something we investigate in the future. We deploy Windows with FOG in the traditional way and it works great, multi-casting for example is a fantastic feature.

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      dcldn @george1421
                                      last edited by Nov 1, 2017, 12:02 PM

                                      @george1421 said in Passing host variable to iPXE menu:

                                      @sebastian-roth I don’t think this is possible here. I think we have the chicken and egg situation here. dhcp knows about the computer’s name because the client tells it during dhcp negotiations. In this case, the client is a new born and doesn’t know enough to tell the dhcp server its name. To get it to work correctly the OP may have to setup dhcp reservations to inform the dhcp server what the client associated with mac address xxxx is.

                                      Exactly this. We should used to furnish boxes with the hostname through DHCP (using option 012) but it requires manually configuring reservations.

                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      1 / 1
                                      • First post
                                        4/18
                                        Last post

                                      154

                                      Online

                                      12.0k

                                      Users

                                      17.3k

                                      Topics

                                      155.2k

                                      Posts
                                      Copyright © 2012-2024 FOG Project