用于Active Directory克隆的Terraform跳过sysprep

时间:2018-12-17 12:41:13

标签: terraform vsphere

我正在将Terraform与vSphere提供程序一起使用来克隆Windows 2012活动目录VM。在几天的问题之后,我已经缩小了范围:

看来您不能对Active Directory域控制器进行sysprep而不弄乱它(无法启动/不再接受凭据),因此在克隆此计算机时我需要跳过sysprep步骤,但是我仍然希望能够静态分配ip使用定制选项解决问题,有关如何执行此操作的任何想法?如果删除自定义块,则它将恢复为dhcp。

Terraform.tf:

resource "vsphere_virtual_machine" "ActiveDirectory_VM" {
  count = 1
  resource_pool_id = "${data.vsphere_resource_pool.target-resource-pool.id}"
  name = "ActiveDirectory_Live"

  datastore_cluster_id = "${data.vsphere_datastore_cluster.datastore_cluster.id}"
  folder = "Terraform/"
  scsi_type = "${data.vsphere_virtual_machine.ActiveDirectory_VM.scsi_type}"

  num_cpus = 4
  memory   = 16000
  guest_id = "${data.vsphere_virtual_machine.ActiveDirectory_VM.guest_id}"

  network_interface {
    network_id = "${data.vsphere_network.Infra_Network.id}"
  }


  disk {
    label = "disk0"
    size = "${data.vsphere_virtual_machine.ActiveDirectory_VM.disks.0.size}"
    eagerly_scrub    = "${data.vsphere_virtual_machine.ActiveDirectory_VM.disks.0.eagerly_scrub}"
    thin_provisioned = "${data.vsphere_virtual_machine.ActiveDirectory_VM.disks.0.thin_provisioned}"
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.ActiveDirectory_VM.id}" 
    customize {

       network_interface {
        ipv4_address = "10.0.0.8"
        ipv4_netmask = 24
      }

      ipv4_gateway = "10.0.0.1"

      windows_options {
        computer_name  = "ActiveDirectory-Live"
      }
    }

  }

}

0 个答案:

没有答案