Search
  • Nikhil Verma

"Dell Poweredge Server Esxi installation even if they are not connected to network"

Problem Statement

Our new Esxi's managment network not configured yet , only Idrac accessible and we need to ready install more than 100 Esxi's.


There are multiple ways of installing Esxi's.Based on Installation method you have choose different ways to build Esxi.

1) Interactive Esxi installation: boot the installer from a CD or DVD, from a bootable USB device, or by PXE booting the installer from a location on the network. If we choose this method this too much time consuming and requires lot of efforts.

2) Scripted Esxi installation : This requires kickstart file (ks.cfg) in which you mentioned all steps. This script you can add in Boot Image , FTP or NFS etc.

If you Choose CD you need to manually mount this CD in IDRAC and then boot from CD to do script installation.

3) vSphere Autodeploy Esxi installation: This one requires vcenter server and has network dependency.

4) Vmware Image Builder: This one requires appliance and also have network dependency.


So none of above method solving our end to end problem.


In this Blog we are going to automate End to End Esxi installation even Esxi don't have management network only IDRAC connected.


We will achieve this in 4 steps:

1) Dell Poweredge server have latest Idrac9 , so we need a script which will interact with Idrac 9 .

2) We need to create Server Configuration Profile(SCP)

3) Will create kickstart file (ks.cfg)

4) We need to create Customized iso in which Ks.cfg present and copied in NFS location .



Why we are using NFS here because SCP only take NFS path.


STEP 1:


How to interact with IDRAC9 and push server configuration profile.

Here Dell already published Redfish API to interact with IDRAC9 , we will use these API to push SCP.

Please find Dell Github link where you will find Import SCP :

https://github.com/dell/iDRAC-Redfish-Scripting/blob/master/Redfish%20Python/ImportSystemConfigurationLocalFilenameREDFISH.py


Command : ImportSystemConfigurationLocalFilenameREDFISH.py -ip 192.168.0.120 -u root -p calvin -t ALL --filename SCP_export_R740


Step 2 :


Now we need to create Customized SCP . First we need to export SCP from any Dummy server.

Now we need to set customize parameters. Few things we should always take care :

1) Configure Idrac with required config like Gateway, Subnet,DNS, NTP and Users.

2) Configure Bios with required config.



=> Secure boot should be disabled


Now we need to export Bios System config profile :


Once Exported we need to modify OSD profile :

You can change expose duration accordingly , here i have set 60 min.

Now our SCP ready.


Step : 3

Create Kickstart file.

1) Install Disk : In my case i need to install in Raid:1 Virtual Disk and rest all data disk were SSD , so i have set SSD exclusion and it will install in VD.

2) Rest are ESXi Name, IP , subnet,gateway,DNS ,NTP ,services and Advance settings config.

Step 4 : Need to Modify boot.cfg

Path : /efi/boot/boot.cfg

Set : kernelopt=runweasel ks=cdrom:/KS.CFG


Now we have to Execute Python script : here i am using centos.

We need input file where you will pass Esxi name, IP and Idrac IP.







################################################
##Author : Nikhil Verma
####################################################

import os, sys ,csv,datetime,shutil
fo = open(r"InputFile.csv")
data = list (csv.DictReader(fo))
result = []
for da in data:
    servername = da['ServerName']
    ip = da['IP']
    print "Updating... %s" % servername + " ...",
    command= "sed -i 's/^network --.*/network --hostname=" + servername + " --device=vmnic0 --vlanid=vlan --bootproto=static --ip="+ ip + " --netmask=subnet --gateway=gw --nameserver=dns1/g' /ks.cfg; sed -i 's/\r$//g' /ks.cfg"
    return_value = os.system(command)
    if return_value == 0:
        print("Completed")
        status = "Completed"
    else:
        status = "Failed"
        print("Failed")
    source = '/ks.cfg'
    dest = '/esxi_cdrom_new_cust'
    shutil.copy(source,dest)
    print("File copied")
    iso_name = "custom_esxi"+servername+".iso"
    os.system('genisoimage -relaxed-filenames -J -R -o '+iso_name+' -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e efiboot.img -no-emul-boot /esxi_cdrom_new_cust')
    print("iso image created")

    os.system('mount -t nfs serverip:/dellconfig /nfsmount')
    shutil.copy(iso_name,'/nfsmount')
    print("iso Copied at NFS")
    idracip = da['IdracIP']
    xml_str = ""
    with open("scp.xml", "r") as fp:
        xml_str = fp.read()
    xml_str = xml_str.replace("custom_esxi.iso", iso_name)
    xml_file ="scp_custom"+servername+".xml"
    with open(xml_file, "w") as fp:
        fp.write(xml_str)
        fp.flush()
    command1 = "python /newimport.py -ip " + idracip + " -u root -p '*******' -t All -f /"+xml_file+" -s Forced"
    print(command1)
    pushconfig = os.system(command1)
    print(pushconfig)


Post Script Execution:


ISO mounted










This is how we can install Esxi even if management Network not configured.





23 views0 comments

Recent Posts

See All