【问题标题】:Windows customization not working with terraformWindows 自定义不适用于 terraform
【发布时间】:2019-05-18 11:23:14
【问题描述】:

我正在尝试使用 terraform 创建和自定义具有 Windows 虚拟机的基础架构。提供者是 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 提供什么其他东西才能使用它吗?

【问题讨论】:

  • 您的模板是否有可用的 IP 地址?
  • 你有没有想过解决这个问题?我在部署 Windows 10 模板时遇到了完全相同的问题。我的 Windows Server 模板可以很好地部署和自定义。

标签: powershell terraform winrm


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2022-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-26
    • 1970-01-01
    • 1970-01-01
    • 2016-04-29
    • 2017-06-25
    相关资源
    最近更新 更多