0

我正在尝试自定义使用 terraform 安装域控制器的 VM Windows Server 2019。这是我如何尝试做到的:

resource "vsphere_virtual_machine" "Active_Directory" {
  name             = "Active Directory"
  num_cpus         = 2
  memory           = 4196
  datastore_id     = data.vsphere_datastore.datastore.id
  host_system_id   = data.vsphere_host.host.id
  resource_pool_id = data.vsphere_resource_pool.pool.id
  guest_id         = data.vsphere_virtual_machine.template_win2016.guest_id
  scsi_type        = data.vsphere_virtual_machine.template_win2016.scsi_type

  # Configure network interface

  network_interface {
    network_id = data.vsphere_network.AD_network.id
  }
  

  disk {
    name = "Active Directory.vmdk"
    size = "35"
  }

  # Define template and customisation params
  clone {
    template_uuid = data.vsphere_virtual_machine.template_win2016.id

    customize {
      #windows_sysprep_text = "${file("data/unattend.xml")}"
      windows_options{
        computer_name="DomainControl"
        admin_password="XXXX"
      }
      
      network_interface {
        ipv4_address = "192.168.7.2"
        ipv4_netmask = 24
      } 
      ipv4_gateway = "192.168.7.1"

    }
  }
}

但是定制并没有按预期进行。Terraform 给我这个一般错误:

╷
│ Error: 
│ Virtual machine customization failed on "XXX/Active Directory":
│ 
│ 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
│ 
│ 
│   with vsphere_virtual_machine.Active_Directory,
│   on 061-Active Directory.tf line 6, in resource "vsphere_virtual_machine" "Active_Directory":
│    6: resource "vsphere_virtual_machine" "Active_Directory" {
│ 

C:/Windows/System32/Sysprep/Panther/setuperr.log 中没有任何内容,我在 setupact.log 中收到了这些警告:

    2021-05-03 09:25:58, Warning    [0x0f008f] SYSPRP RunRegistryDlls:Registry key is either empty or malformed: SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SysPrepExternal\Cleanup
    2021-05-03 09:25:58, Warning    [0x0f008f] SYSPRP RunRegistryDlls:Registry key is either empty or malformed: SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SysPrepExternal\Generalize
    2021-05-03 09:25:59, Warning                      [shsetup] CleanupAdministratorPassword: NetUserGetInfo(23) failed (0x800708b3)
    2021-05-03 09:25:59, Warning               SYSPRP MSS: Cleanup cannot delete Directory C:\ProgramData\Microsoft\Search\Data\Applications\Windows in Windows Search Data Directory with error 0x3.
    2021-05-03 09:25:59, Warning               SYSPRP MSS: Cleanup call failed to delete data folder C:\ProgramData\Microsoft\Search\Data\Applications\Windows - error 0x0.
    2021-05-03 09:26:00, Warning                      TapiSysPrep.dll:RetainTapiLocations:RegQueryValueEx() returned 2
    2021-05-03 09:26:26, Warning               SYSPRP SPPNP: Failed to configure netvwifibus.inf. Err = 0x2
    2021-05-03 09:26:32, Warning               SYSPRP SPPNP: Unable to configure all driver packages. Err = 0x2
    2021-05-03 09:26:32, Warning               SYSPRP iphlpsvc.dll: sysprep generalize failed to delete tunnel registry
    2021-05-03 09:26:32, Warning               SYSPRP iphlpsvc.dll: sysprep generalize failed to delete tunnel registry
    2021-05-03 09:26:33, Warning               SYSPRP Ignoring folder Deleted because could not convert to family name

我发现 0x800708b3 表示“安全数据库尚未启动”。我想这是 Sysprep 工作必须解决的主要错误。我签入:/Windows/Panther/setup.etl 以查看导致数据库无法启动的原因,但我什么也没找到。(或者也许我只是不知道要搜索什么)

有谁知道我应该在哪里解决这个问题或如何解决它?

4

0 回答 0