diff --git a/ubuntu/iso/x86_64/ubuntu-20.04-x86_64.pkrvars.hcl b/ubuntu/iso/x86_64/ubuntu-20.04-x86_64.pkrvars.hcl new file mode 100644 index 0000000..aefb6a6 --- /dev/null +++ b/ubuntu/iso/x86_64/ubuntu-20.04-x86_64.pkrvars.hcl @@ -0,0 +1,6 @@ +efi_boot = true +efi_firmware_code = "/usr/share/OVMF/OVMF_CODE.fd" +efi_firmware_vars = "/usr/share/OVMF/OVMF_VARS.fd" +iso_checksum = "file:https://releases.ubuntu.com/20.04.6/SHA256SUMS" +iso_url = "https://releases.ubuntu.com/20.04.6/ubuntu-20.04.6-live-server-amd64.iso" +vm_name = "ubuntu-20.04-bios-x86_64.qcow2" diff --git a/ubuntu/iso/x86_64/ubuntu.pkr.hcl b/ubuntu/iso/x86_64/ubuntu.pkr.hcl index df7db2e..ce1e16a 100644 --- a/ubuntu/iso/x86_64/ubuntu.pkr.hcl +++ b/ubuntu/iso/x86_64/ubuntu.pkr.hcl @@ -60,6 +60,18 @@ build { sources = ["sources.file.user_data", "sources.file.meta_data"] } +variable "boot_command" { + type = list(string) + default = [ + "c", + "linux /casper/vmlinuz autoinstall 'ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ---", + "", + "initrd /casper/initrd", + "", + "boot", + ] +} + variable "efi_boot" { description = "Boot in EFI mode instead of BIOS." type = bool @@ -99,19 +111,12 @@ variable "vm_name" { source "qemu" "ubuntu" { # Ubuntu 20.04 image default timeout is 5s, so we need to be fast boot_wait = "5s" - boot_command = [ - "c", - "linux /casper/vmlinuz autoinstall 'ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ---", - "", - "initrd /casper/initrd", - "", - "boot", - ] + boot_command = var.boot_command accelerator = "kvm" cpus = 2 disk_interface = "virtio-scsi" disk_size = "16G" - disk_compression = true + disk_compression = true format = "qcow2" headless = false http_directory = var.http_directory @@ -129,7 +134,7 @@ source "qemu" "ubuntu" { efi_boot = var.efi_boot efi_firmware_code = var.efi_firmware_code efi_firmware_vars = var.efi_firmware_vars - qemuargs = [ + qemuargs = [ ["-cpu", "host"] ] }