Nest ESXをコマンドラインでインポート

投稿者: | 12月 21, 2022

前回に続き、内職シリーズ。ESXの上でESXを動かすことができるのがNest ESX。ちなみに、VMware WorkstationでNest ESXを動かすと、WSLが全滅するので、VMware Workstation上でNest ESXを使うのはお勧めしない。DockerやRancher Desktopも動かない。レガシーな仕事だけで終わらせるつもりなら止めないが。

Nest ESXを作成する場合、ISOイメージからイチから作っても構わないが、はっきり言ってタルい。Nest ESXを以下からダウンロードしてインポートをして使うことをお勧めする。

http://vmwa.re/nestedesxi

このイメージは、vSANが簡単に構築できるように複数のDataStoreが事前に設定されている。リリースタイミングも驚くほど速い。しかし、このイメージもインポート時にパラメーターが必要なので、それなりに大変。ESXの構築は、複数台、ホスト名、IPアドレスを変えてインポートをするので結構面倒。ここは内職(自動化)する価値が多いにある。

 

閑話休題

 

Nest ESXをインポートするにはOVF Toolが必要

以下からダウンロードができる。ちなみに、OVF Tool 4.5は、vSphere 8対応版らしい。

https://developer.vmware.com/web/tool/4.4.0/ovf

https://developer.vmware.com/web/tool/4.5.0/ovf-tool

もし、VMware WorkstationやFusionがインストールされている環境の場合、実はすでにOVF Toolもインストールされている。手元のVMware Fusion 13だと、/Applications/VMware Fusion.app/Contents/Library/VMware OVF ToolというフォルダにOVF Tool 4.5が入っていた。VMware Workstationだと、C:\Program Files (x86)\VMware\VMware Workstation\OVFTool にインストールされていた。

 

パラメータの確認

ovftool --allowExtraConfig Nested_ESXi7.0u3i_Appliance_Template_v1.ova

こんなパラメータがある。

Properties:
  Key: guestinfo.hostname
  Category: Networking
  Label: Hostname
  Type: string
  Description: ESXi Hostname (DHCP if left blank)

  Key: guestinfo.ipaddress
  Category: Networking
  Label: IP Address
  Type: string
  Description: IP Address of vmk0 (DHCP if left blank)

  Key: guestinfo.netmask
  Category: Networking
  Label: Netmask
  Type: string
  Description: Netmask of vmk0 (DHCP if left blank)

  Key: guestinfo.gateway
  Category: Networking
  Label: Gateway
  Type: string
  Description: Gateway of vmk0 (DHCP if left blank)

  Key: guestinfo.vlan
  Category: Networking
  Label: VLAN ID
  Type: string
  Description: VLAN ID of vmk0 (DHCP if left blank)

  Key: guestinfo.dns
  Category: Networking
  Label: DNS
  Type: string
  Description: DNS Server (DHCP if left blank)

  Key: guestinfo.domain
  Category: Networking
  Label: DNS Domain
  Type: string
  Description: DNS Domain (DHCP if left blank)

  Key: guestinfo.ntp
  Category: Configurations
  Label: NTP Servers
  Type: string
  Description: NTP Server
  Value: pool.ntp.org

  Key: guestinfo.syslog
  Category: Configurations
  Label: Syslog Server
  Type: string
  Description: Syslog Server
  Value: 192.168.1.200

  Key: guestinfo.password
  Category: Configurations
  Label: Password
  Type: password
  Description: ESXi Root Password (default VMware1!)

  Key: guestinfo.ssh_key
  Category: Configurations
  Label: SSH Key
  Type: string
  Description: SSH Public Key (Optional)

  Key: guestinfo.ssh
  Category: Configurations
  Label: SSH
  Type: boolean
  Description: Enable SSH
  Value: True

  Key: guestinfo.createvmfs
  Category: Configurations
  Label: VMFS
  Type: boolean
  Description: Automatically create local VMFS Datastore (datastore1)
  Value: False

  Key: guestinfo.followmac
  Category: Configurations
  Label: Follow Hardware MAC Address
  Type: boolean
  Description: Enable to support cloning of Nested ESXi VM
  Value: False

以下のコマンドでインポートをする。

ちなみに、Netmaskは255.255.255.0のような設定をしないと正しく動作しない。

  

vCenter  

ovftool \
  --X:logFile="ovftool.log" \
  --acceptAllEulas \
  --allowAllExtraConfig \
  --allowExtraConfig \
  --noSSLVerify \
  --name=YOUR_VMNAME \
  --datastore=YOUR_DATASTORE \
  --diskMode=thin \
  --net:"VM Network=YOUR_NETEWORK" \
  --prop:guestinfo.hostname="YOUR_ESX_HOSTNAME \
  --prop:guestinfo.ipaddress="YOUR_ESX_IP" \
  --prop:guestinfo.netmask="YOUR_NETMASK" \
  --prop:guestinfo.gateway="YOUR_GATEWAY" \
  --prop:guestinfo.dns="YOUR_DNS" \
  --prop:guestinfo.domain="YOUR_DOMAIN" \
  --prop:guestinfo.ntp="YOUR_NTP" \
  --prop:guestinfo.syslog="YOUR_SYSLOG" \
  --prop:guestinfo.password="YOUR_ESX_ROOT_PASSWORD" \
  --prop:guestinfo.ssh=True \
  --prop:guestinfo.createvmfs=True \
  Nested_ESXi7.0u3i_Appliance_Template_v1.ova \
  vi://YOUR_VC_ADMIN:"YOUR_VC_PASSWORD"@YOUR_VCENTER/Datacenter/host/YOUR_ESX_HOSTNAME

 

ESX。vCenterに登録されているESXではインポートできない。  (なぜだかわからないがguestinfoが正しく設定されない。参考情報)

ovftool \
  --X:logFile="ovftool.log" \
  --acceptAllEulas \
  --allowAllExtraConfig \
  --allowExtraConfig \
  --noSSLVerify \
  --name=YOUR_VMNAME \
  --datastore=YOUR_DATASTORE \
  --diskMode=thin \
  --net:"VM Network=YOUR_NETEWORK" \
  --prop:guestinfo.hostname="YOUR_ESX_HOSTNAME \
  --prop:guestinfo.ipaddress="YOUR_ESX_IP" \
  --prop:guestinfo.netmask="YOUR_NETMASK" \
  --prop:guestinfo.gateway="YOUR_GATEWAY" \
  --prop:guestinfo.dns="YOUR_DNS" \
  --prop:guestinfo.domain="YOUR_DOMAIN" \
  --prop:guestinfo.ntp="YOUR_NTP" \
  --prop:guestinfo.syslog="YOUR_SYSLOG" \
  --prop:guestinfo.password="YOUR_ESX_ROOT_PASSWORD" \
  --prop:guestinfo.ssh=True \
  --prop:guestinfo.createvmfs=True \
  Nested_ESXi7.0u3i_Appliance_Template_v1.ova \
  vi://root:"YOUR_ESX_ROOT_PASSWORD"@YOUR_ESX_HOSTNAME/

 ちなみに、インポート後にPower ONをしたい場合は、

–powerOn

を付ける。

 

ESXでインポートがうまくいかないのは調査中だが、vCenterだとうまく動いた。インポートのスピードはvSphere Clientからのインポートと比較にならないぐらい速い!!!

はっきり言って、vSphere Clientからのインポートをするのは完全に負け組の気がしてならない。時間泥棒だと思う。

コメントを残す