5 Replies Latest reply on Aug 28, 2012 10:53 AM by MCioe

    What's best way to configure multiple servers with ESXi 5 Scripted Install?

    MCioe Enthusiast

      I have written a large kickstart script to configure a server.  The script is working fine for a single server and is organized such that I define a list of about 20 variables (after the firstboot command) and then I have a long list of commands configuring the server using the variables defined at the beginning.

       

      I would now like to update my script to configure another 55 servers.  I would be interested to know the best way to tackle this.  My choices look to be the following:

       

           a. I could write 55 more kickstart files where the only difference is the 20 variables at the beginning and have the user pick the kickstart file he would like to run from the Install Menu.  Maintaining 55 files is the biggest problem with this approach if I have to change the configuration.

       

           b. I could make 55 files which define my variables (which is selected by the user from the install menu) and then pass the variables (either as arguments or ENV variables or written to a file) to a single file which does the bulk of the work, but I’m not sure how to invoke a separate script from the kickstart file.  I’m worried I may have to learn python

       

           c. Is there a way the user can enter some unique data (e.g. hostname, IP address) into the kickstart file? I could write one large script which defines all my variables for each server and performs the bulk configuration steps at the end.  Then I would only have one big script which would be ok for maintainability.

       

      I appreciate any suggestions on the best approach.

        • 1. Re: What's best way to configure multiple servers with ESXi 5 Scripted Install?
          Troy Clavell Guru
          User ModeratorsvExpert

          you could created 55 new ks.cfg files place it in your media, then edit the isolinux.cfg file.  This way, when the system boots, you arrow down the server you wish to build and you good.

           

          An example of our isolinux.cfg (we have about 60 in ours)

           

          default menu.c32
          menu title VMware VMvisor Boot Menu
          timeout 3000
           
          label -
                  menu label ^Our Company Installs:
                  menu disable
           
          label phx03536
                  menu label ^Install hostmane.domainname.com
                  menu indent 1
                  kernel mboot.c32
                  append vmkboot.gz ks=cdrom:/ks1.CFG --- vmkernel.gz --- sys.vgz --- cim.vgz --- ienviron.vgz --- install.vgz
          
          label phx03537
                  menu label ^Install hostmane.domainname.com
                  menu indent 1
                  kernel mboot.c32
                  append vmkboot.gz ks=cdrom:/ks2.CFG --- vmkernel.gz --- sys.vgz --- cim.vgz --- ienviron.vgz --- install.vgz
          

           

          ...

          • 2. Re: What's best way to configure multiple servers with ESXi 5 Scripted Install?
            MCioe Enthusiast

            Right, that would be option a. in the original post, but then if I have to make a change, I have to change it in 55 kickstart files.  I'm hoping to avoid that if I can.

             

            I'm trying to find a way to keep the bulk of the scripts in as few files as possible.

            • 3. Re: What's best way to configure multiple servers with ESXi 5 Scripted Install?
              Troy Clavell Guru
              vExpertUser Moderators

              I think you're going to have to have manual intervention how ever you decide.  If you have Enterprise Plus, you can you autodeploy. You can use PXE, but again there is still files that need massaging every now and again.

               

              We don't have Enterprise Plus and haven't explored PXE just yet. So, for us, adding multiple files into a single CD image makes it a bit less cumbersome.

              • 4. Re: What's best way to configure multiple servers with ESXi 5 Scripted Install?
                MCioe Enthusiast

                I don't have Enterprise Plus and I don't think I can use the PXE option.  If I have to write 55 scripts then that is what I'll do, but it just seem like there should be an easier/better way. 

                • 5. Re: What's best way to configure multiple servers with ESXi 5 Scripted Install?
                  MCioe Enthusiast

                  Just to follow up on this, I did end up using a Python script that one of my co-workers was able to get working.  The first thing I did was to update isolinux.cfg to pass in my "parameters".  This approach has been already been documented on other sites:  http://www.virtuallyghetto.com/2011/05/semi-interactive-automated-esxi.html.

                   

                  APPEND -c boot.cfg ks=cdrom:/KICKSTART/KS.CFG HOSTNAME=host_name IP=1.1.1.1

                   

                  HOSTNAME=host_name and IP=1.1.1.1 end up being written to /var/log/esxi_install.log which persists after the first boot.  My problem occurred when I couldn't get to these values using traditional Linux commands (awk, sed, cut).  I could use cat and grep, but I couldn't get any closer in the ks.cfg execution.

                   

                  We ended up using heredoc (cat > /tmp/getargs.py << EOF) to create a 25 line python script right in my ks.cfg file which would read the esxi_install.log file, parse my variable strings and write them to another file (/tmp/args.cfg).

                  args.cfg ended up looking like:

                      export HOSTNAME=host_name

                      export IP=1.1.1.1

                   

                  After creating getargs.py, I could execute "python /tmp/getargs.py" and then "source args.cfg" from my ks.cfg file. My variables (HOSTNAME and IP) were then accessible in the rest of my kickstart file and I was off and running without writing 55 separate ks.cfg files for each host.