我正在尝试使用terraform和vsphere provider基于模板(ubuntu 18.04)创建VM。 terraform apply..
命令显示的最终错误是:
* vsphere_virtual_machine.vm: timeout waiting for an available IP address
但是,将创建VM,并接收vsphere_virtual_machine资源内“克隆”部分中设置的IP地址。
resource "vsphere_virtual_machine" "vm" {
count = "${var.count}"
name = "${lookup(var.vm_name, count.index + 1)}"
resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
network_interface {
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}
disk {
...
}
clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
customize {
linux_options {
host_name = "${lookup(var.hostname, count.index + 1)}"
domain = "${var.domain}"
}
dns_server_list = ["${var.ns1}", "${var.ns2}"]
network_interface {
ipv4_address = "${lookup(var.ipv4_address, count.index + 1)}"
ipv4_netmask = "${var.ipv4_netmask}"
}
ipv4_gateway = "${var.ipv4_gateway}"
}
}
}
toolsDeployPkg.log
文件显示以下错误:
[2018-09-10T18:07:12.557Z] [ info] ENTER STATE Done
[2018-09-10T18:07:12.557Z] [ info] EXIT STATE INPROGRESS
[2018-09-10T18:07:12.557Z] [ info] Deployment succeeded.
[2018-09-10T18:07:12.557Z] [ info] Launching cleanup.
[2018-09-10T18:07:12.557Z] [ debug] Command to exec : /bin/rm
[2018-09-10T18:07:12.557Z] [ info] sizeof ProcessInternal is 56
[2018-09-10T18:07:12.557Z] [ info] Returning, pending output from stdout
[2018-09-10T18:07:12.558Z] [ info] Returning, pending output from stderr
[2018-09-10T18:07:12.658Z] [ info] Process exited normally after 0 seconds, returned 0
[2018-09-10T18:07:12.658Z] [ info] No more output from stdout
[2018-09-10T18:07:12.658Z] [ info] No more output from stderr
[2018-09-10T18:07:12.658Z] [ info] Customization command output:
[2018-09-10T18:07:12.658Z] [ info] sSkipReboot: false, forceSkipReboot false
[2018-09-10T18:07:12.658Z] [ debug] Ran DeployPkg_DeployPackageFromFile successfully
[2018-09-10T18:07:12.658Z] [ debug] ## Closing log
[2018-09-10T18:07:12.658Z] [ info] Rebooting
[2018-09-10T18:07:12.658Z] [ debug] Command to exec : /sbin/telinit
[2018-09-10T18:07:12.658Z] [ info] sizeof ProcessInternal is 56
[2018-09-10T18:07:12.658Z] [ info] Returning, pending output from stdout
[2018-09-10T18:07:12.658Z] [ info] Returning, pending output from stderr
[2018-09-10T18:07:12.769Z] [ error] Process exited abnormally after 0 sec, uncaught signal 15
[2018-09-10T18:07:12.769Z] [ info] No more output from stdout
[2018-09-10T18:07:12.769Z] [ info] No more output from stderr
[2018-09-10T18:07:12.769Z] [ info] Customization command output:
[2018-09-10T18:07:13.633Z] [ error] telinit returned error 127
我是否需要在vCenter中配置其他选项?我正在使用以下软件: