diff --git a/examples/hcl/ubuntu/build.pkr.hcl b/examples/hcl/ubuntu/build.pkr.hcl index 04e306c6d..2c5bb1022 100644 --- a/examples/hcl/ubuntu/build.pkr.hcl +++ b/examples/hcl/ubuntu/build.pkr.hcl @@ -66,6 +66,14 @@ EOF boot_command = local.ubuntu_1804_boot_command } + source "source.vmware-iso.esxi-base-ubuntu-amd64" { + name = "16.04-from-esxi" + iso_url = local.iso_url_ubuntu_1604 + iso_checksum = "file:${local.iso_checksum_url_ubuntu_1604}" + output_directory = "vmware_iso_ubuntu_1604_amd64_from_esxi" + boot_command = local.ubuntu_1604_boot_command + } + source "source.qemu.base-ubuntu-amd64" { name = "16.04" iso_url = local.iso_url_ubuntu_1604 diff --git a/examples/hcl/ubuntu/source.esxi-vmware-iso.pkr.hcl b/examples/hcl/ubuntu/source.esxi-vmware-iso.pkr.hcl new file mode 100644 index 000000000..53257272b --- /dev/null +++ b/examples/hcl/ubuntu/source.esxi-vmware-iso.pkr.hcl @@ -0,0 +1,24 @@ +source "vmware-iso" "esxi-base-ubuntu-amd64" { + headless = var.headless + boot_wait = "10s" + guest_os_type = "ubuntu-64" + http_directory = local.http_directory + shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" + ssh_password = "vagrant" + ssh_port = 22 + ssh_timeout = "10000s" + ssh_username = "vagrant" + tools_upload_flavor = "linux" + vmx_data = { + "cpuid.coresPerSocket" = "1" + "ethernet0.pciSlotNumber" = "32" + } + vmx_remove_ethernet_interfaces = true + + remote_type = "esx5" + remote_host = var.esxi_host + remote_username = var.esxi_user + remote_password = var.esxi_password + remote_datastore = var.datastore + remote_private_key_file = var.remote_private_key_file_path +} diff --git a/examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl b/examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl index 09bfcf57b..b424c8ef0 100644 --- a/examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl +++ b/examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl @@ -10,17 +10,23 @@ // export PKR_VAR_vcenter_user="" // export PKR_VAR_vm_ip="" // export PKR_VAR_gateway_ip="" +// ... variable "vcenter_endpoint" { type = string } variable "vcenter_user" { type = string } variable "vcenter_password" { type = string } variable "esxi_host" { type = string } +variable "esxi_password" { type = string } +variable "esxi_user" { type = string } variable "datacenter_name" { type = string } variable "vm_ip" { type = string } variable "gateway_ip" { type = string } variable "datastore" { default = "datastore1" } +variable "remote_private_key_file_path" { + type = string +} source "vsphere-iso" "base-ubuntu-amd64" { vcenter_server = var.vcenter_endpoint