diff --git a/packer/source.pkr.hcl b/packer/source.pkr.hcl index 47cd546..8acec86 100644 --- a/packer/source.pkr.hcl +++ b/packer/source.pkr.hcl @@ -1,60 +1,61 @@ source "vsphere-iso" "ubuntu" { - vcenter_server = var.hv_fqdn - username = var.hv_username - password = var.hv_password - insecure_connection = "true" + vcenter_server = var.hv_fqdn + username = var.hv_username + password = var.hv_password + insecure_connection = "true" - datacenter = var.hv_datacenter - cluster = var.hv_cluster - host = var.hv_host - folder = var.hv_folder - datastore = var.hv_datastore + datacenter = var.hv_datacenter + cluster = var.hv_cluster + host = var.hv_host + folder = var.hv_folder + datastore = var.hv_datastore - guest_os_type = "ubuntu64Guest" + guest_os_type = "ubuntu64Guest" - boot_order = "disk,cdrom" - boot_command = [ + boot_order = "disk,cdrom" + boot_command = [ "e", " autoinstall ds=nocloud;", "" ] - boot_wait = "2s" + boot_wait = "2s" - communicator = "ssh" - ssh_username = "ubuntu" - ssh_password = var.ssh_password - ssh_timeout = "20m" - ssh_handshake_attempts = "100" - ssh_pty = true + communicator = "ssh" + ssh_username = "ubuntu" + ssh_password = var.ssh_password + ssh_timeout = "20m" + ssh_handshake_attempts = "100" + ssh_pty = true - CPUs = 4 - RAM = 8192 + CPUs = 4 + RAM = 8192 network_adapters { - network = var.hv_network - network_card = "vmxnet3" + network = var.hv_network + network_card = "vmxnet3" } storage { - disk_size = 76800 - disk_thin_provisioned = true + disk_size = 76800 + disk_thin_provisioned = true } - disk_controller_type = ["pvscsi"] - usb_controller = ["xhci"] + disk_controller_type = ["pvscsi"] + usb_controller = ["xhci"] - cd_files = [ + set_host_for_datastore_uploads = true + cd_files = [ "packer/preseed/UbuntuServer22.04/user-data", "packer/preseed/UbuntuServer22.04/meta-data" ] - cd_label = "cidata" - iso_url = local.iso_authenticatedurl - iso_checksum = var.iso_checksum + cd_label = "cidata" + iso_url = local.iso_authenticatedurl + iso_checksum = var.iso_checksum - shutdown_command = "echo '${var.ssh_password}' | sudo -S shutdown -P now" - shutdown_timeout = "5m" + shutdown_command = "echo '${var.ssh_password}' | sudo -S shutdown -P now" + shutdown_timeout = "5m" - remove_cdrom = true + remove_cdrom = true export { - output_directory = "/scratch" + output_directory = "/scratch" } }