一、什麼是esxi-customizer
ESXi是VMware公司推出的一款類型較小的、高可靠性的嵌入式操作系統,主要用於虛擬化平台中作為虛擬機的宿主操作系統。而esxi-customizer則是一個通過自動化腳本的方式為ESXi ISO鏡像進行定製的工具,可以滿足用戶在安裝ESXi時針對個性化需求進行定製。這種定製化的過程不需要用戶自行手動編輯ISO,而是通過esxi-customizer來進行自動化定製。
二、esxi-customizer的特點
1、自動化腳本化操作
通過esxi-customizer,用戶不需要手動編寫腳本進行ESXi鏡像的定製。相反,工具會自動執行腳本來自動化地修改運行ESXi的操作系統鏡像。
2、針對個性化需求進行定製
esxi-customizer提供了多種選項來定製ESXi鏡像,用戶可以根據自己的需求選擇對應的選項來完成ESXi的個性化。
3、支持PowerCLI
用戶也可以通過PowerCLI來使用esxi-customizer完成ESXi ISO鏡像的定製,在使用PowerCLI時,esxi-customizer會自動推導出需要使用的工具並執行。
三、使用esxi-customizer進行定製ESXi鏡像
1、下載esxi-customizer腳本文件
curl -O https://raw.githubusercontent.com/VFrontDe/esxi-customizer-ps/master/ESXi-Customizer-PS-v2.6.0.ps1
2、使用PowerCLI啟動esxi-customizer
Import-Module .\ESXi-Customizer-PS-v2.6.0.ps1
Get-EsxSoftwareDepot -DepotUrl https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | Get-EsxImageProfile | Select-Object Name
上述代碼展示了如何使用Get-EsxSoftwareDepot命令獲取可用的ESXi版本,使用Get-EsxImageProfile命令選擇一個ESXi版本進行鏡像定製,其中ESXi-Customizer-PS的版本可能需要根據實際情況進行更改。
3、選擇ESXi版本進行定製化操作
New-EsxImageProfile -CloneProfile ESXi-7.0b-16324942-Standard -Name MyCustomizerImage
& .\ESXi-Customizer-PS-v2.6.0.ps1 -v60 -vft -load net-e1000e -load net55-r8168 -load sata-xahci -load sata-ahci
-izip C:\ESXi-7.0b-16324942-depot.zip -iprofile MyCustomizerImage
Add-EsxSoftwarePackage -ImageProfile MyCustomizerImage -SoftwarePackage ./path/to/file.vib
上述代碼展示了如何使用MyCustomizerImage鏡像進行實際的定製化操作,其中選項-v、-l和-i等選項分別代表選擇ESXi版本,加載driver以及鏡像文件路徑。Add-EsxSoftwarePackage命令確認還會額外添加一個vib文件進行鏡像定製。
四、esxi-customizer的批量生成ISO鏡像
1、創建一個文本文件包含所有需要定製ESXi版本的信息
Get-EsxSoftwareDepot -DepotUrl https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | Get-EsxImageProfile | Select-Object Name | Out-File -FilePath "c:\esxi-customizer\profiles.txt"
2、創建esxi-customizer批處理腳本customizer.bat
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File ".\ESXi-Customizer-PS-v2.6.0.ps1"
setlocal EnableDelayedExpansion
for /F "tokens=* usebackq" %%F in ("c:\esxi-customizer\profiles.txt") do (
set url=https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/
set profile=%%F
set profile=!profile: =!
set profile=!profile:(*)=!
set profile=!profile:!=!
.\ESXi-Customizer-PS-v2.6.0.ps1 -vib "c:esxi-customizer\my.vib" -load net55-r8168,net-e1000e,sata-xahci,sata-ahci -izip "C:\esxi-customizer\VMware-VMvisor-Installer-201701001-4887370.x86_64-DellEMC_Customized-A06.iso" -iprofile "!profile!" -outpath "C:\esxi-customizer" -outiso
)
3、執行esxi-customizer定製ISO鏡像
customizer.bat
上述代碼展示了如何批量生成ESXi鏡像,其中profiles.txt文本文件包含了需要定製的ESXi版本列表。customizer.bat命令將在C:\ esxi-customizer下輸出定製的ISO鏡像文件。
五、總結
通過esxi-customizer,用戶可以實現ESXi ISO鏡像的自動化定製,針對用戶個性化需求進行界面化操作。用戶可以通過PowerCLI和批處理腳本的方式來進行批量的ESXi鏡像生成操作,降低了用戶的工作難度。
原創文章,作者:WFFTV,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/333204.html