VMware で実行される AL2023 での VMware guestinfo の cloud-init 設定 - Amazon Linux 2023

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

VMware で実行される AL2023 での VMware guestinfo の cloud-init 設定

VMware 環境には Amazon EC2 インスタンスメタデータサービス (IMDS) がないため、AL2023 を設定する別の方法が必要です。このセクションでは、VMware vSphere で使用できる seed.iso 仮想 CD-ROM ドライブに代わる設定メカニズムを使用する方法について説明します。

この設定方法では、VMware extraconfig メカニズムを使用して設定データを cloud-init に提供します。次の各キーには、対応する keyname.encoding プロパティを指定する必要があります。

VMware extraconfig メカニズムには以下のキーを指定できます。

guestinfo.metadata

cloud-init メタデータを含む JSON または YAML

guestinfo.userdata

cloud-config フォーマットの cloud-init ユーザーデータを含む YAML ドキュメント

guestinfo.vendordata (オプション)

cloud-init ベンダーデータを含む YAML

対応するエンコーディングプロパティ (guestinfo.metadata.encodingguestinfo.userdata.encoding、および guestinfo.vendordata.encoding) には以下を含めることができます。

base64

プロパティの内容は base64 エンコードされます。

gzip+base64

プロパティの内容は base64 エンコード後に gzip で圧縮されます。

注記

seed.iso メソッドは別の (オプションの) network-config 設定ファイルをサポートします。VMware guestinfo ではネットワーク設定の提供方法が異なります。以下のセクションで、さらに詳しい情報を提供しています。

明示的なネットワーク設定が必要な場合は、2 つの YAML または JSON プロパティのフォーマットで metadata に埋め込む必要があります。

network

JSON または YAML 形式でエンコードされたネットワーク設定が含まれます。

network.encoding

上記のネットワーク設定データのエンコーディングが含まれます。cloud-init でサポートされているエンコーディングは、guestinfo データのエンコーディングと共通です: base64 および gzip+base64

例 VMware vSphere govc CLI ツールを使用して guestinfo で設定を渡す
  1. KVM および VMware での Amazon Linux 2023 の NoCloud (seed.iso) cloud-init 設定」の説明に従って meta-datauser-data、およびオプションの network-config 設定ファイルを準備します。

  2. 設定ファイルを VMware guestinfo で使用できる形式に変換します。

    # 'meta-data', `user-data` and `network-config` are the configuration # files in the same format that would be used by a NoCloud (seed.iso) # data source, read-them and convert them to VMware guestinfo # # The VM_NAME variable is assumed to be set to the name of the VM # It is assumed that the necessary govc environment (credentials etc...) are already set metadata=$(cat "meta-data") userdata=$(cat "user-data") if [ -e "network-config" ] ; then # We need to embed the network config inside the meta-data netconf=$(base64 -w0 "network-config") metadata=$(printf "%s\nnetwork: %s\nnetwork.encoding: base64" "$metadata" "$netconf") fi metadata=$(base64 -w0 <<< "$metadata") govc vm.change -vm "$VM_NAME" \ -e guestinfo.metadata="$metadata" \ -e guestinfo.metadata.encoding="base64" userdata=$(base64 -w0 <<< "$userdata") govc vm.change -vm "$VM_NAME" \ -e guestinfo.userdata="$userdata" \ -e guestinfo.userdata.encoding="base64"