Skip to content

Commit

Permalink
Add Ubuntu 20.04 image installed from ISO
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Oct 8, 2023
1 parent f65caab commit fee0447
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions ubuntu/iso/x86_64/ubuntu-20.04-x86_64.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -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"
25 changes: 15 additions & 10 deletions ubuntu/iso/x86_64/ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ build {
sources = ["sources.file.user_data", "sources.file.meta_data"]
}

variable "boot_command" {
type = list(string)
default = [
"c<wait>",
"linux /casper/vmlinuz autoinstall 'ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ---",
"<enter>",
"initrd /casper/initrd",
"<enter>",
"boot<enter><wait>",
]
}

variable "efi_boot" {
description = "Boot in EFI mode instead of BIOS."
type = bool
Expand Down Expand Up @@ -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<wait>",
"linux /casper/vmlinuz autoinstall 'ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/' ---",
"<enter>",
"initrd /casper/initrd",
"<enter>",
"boot<enter><wait>",
]
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
Expand All @@ -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"]
]
}
Expand Down

0 comments on commit fee0447

Please sign in to comment.