Files
packerCHS/ubuntu-packer/ubuntu.pkr.hcl
martin.cholewa 0287e20e75
Some checks failed
Build Ubuntu Image / packer-build (push) Failing after 1m5s
checksum
2025-06-20 11:47:01 +02:00

45 lines
1.1 KiB
HCL

packer {
required_plugins {
qemu = {
version = ">= 1.0.0"
source = "github.com/hashicorp/qemu"
}
}
}
variable "ubuntu_iso_url" {
type = string
default = "https://releases.ubuntu.com/22.04/ubuntu-22.04.4-live-server-amd64.iso"
}
variable "ubuntu_iso_checksum" {
type = string
default = "sha256:e5b944550b6cf926cf0a6a6c62dd8a964c57bb42e2909f26e29f03e2c0d6f1c6"
}
source "qemu" "ubuntu" {
iso_url = var.ubuntu_iso_url
iso_checksum = var.ubuntu_iso_checksum
output_directory = "output/ubuntu"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
communicator = "ssh"
ssh_username = "ubuntu"
ssh_password = "ubuntu"
ssh_wait_timeout = "20m"
disk_interface = "virtio"
format = "qcow2"
accelerator = "hvf" # macOS, jinak např. kvm
headless = true
boot_wait = "10s"
boot_command = [
"<esc><wait>",
"autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter>"
]
http_directory = "http"
}
build {
sources = ["source.qemu.ubuntu"]
}