gpt4 book ai didi

powershell - Windows 自定义不适用于 Terraform

转载 作者:行者123 更新时间:2023-12-05 07:27:48 24 4
gpt4 key购买 nike

我正在尝试使用 Terraform 创建和自定义具有 Windows VM 的基础架构。提供者是 VMWare vSphere。 VM 创建已正确完成,但客户端机器内部的自定义未正确完成。我的配置如下:

resource "vsphere_virtual_machine" "vm" {
count = "2"
name = "${var.virtual_machine_name_prefix}${count.index}"
resource_pool_id = "${data.vsphere_resource_pool.resource_pool.id}"
host_system_id = "${data.vsphere_host.host.*.id[count.index]}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
folder = "my-vm-folder"
num_cpus = 8
memory = 8192
guest_id = "${data.vsphere_virtual_machine.template.guest_id}"

scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}"

network_interface {
# label = "${data.vsphere_network.network.name}"
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}

disk {
label = "disk0"
size = "${data.vsphere_virtual_machine.template.disks.0.size}"
}

clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"

customize {
windows_options {
computer_name = "${var.virtual_machine_name_prefix}${count.index}"
full_name = "${var.virtual_machine_name_prefix}${count.index}"
organization_name = "myorg"
join_domain = "mydomain.com"
domain_admin_user = "admin"
domain_admin_password = "P@ssword"
}

network_interface {
dns_server_list = ["${var.virtual_machine_dns_servers}"]
}
}
}
}

每当我尝试创建时,我收到的错误消息是:

* vsphere_virtual_machine.vm[1]: 1 error(s) occurred:

* vsphere_virtual_machine.vm.1:
Virtual machine customization failed on "/foldername/vm-name-1":

timeout waiting for customization to complete

The virtual machine has not been deleted to assist with troubleshooting. If
corrective steps are taken without modifying the "customize" block of the
resource configuration, the resource will need to be tainted before trying
again. For more information on how to do this, see the following page:
https://www.terraform.io/docs/commands/taint.html

看起来 Terraform 无法与导致超时的客户端 VM 通信。我还需要向 Terraform 提供任何其他信息才能融入其中吗?

最佳答案

如果自定义失败时 VM 屏幕上显示“Windows 安装程序无法配置 Windows 以在这台计算机的硬件上运行”,则可能是 sysprep 出了问题。

关于powershell - Windows 自定义不适用于 Terraform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53826311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com