-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu24.pkr.hcl
60 lines (55 loc) · 1.47 KB
/
ubuntu24.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Packer : https://www.packer.io/
packer {
required_plugins {
qemu = {
version = ">= 1.1.0"
source = "github.com/hashicorp/qemu"
}
vagrant = {
version = "~> 1"
source = "github.com/hashicorp/vagrant"
}
}
}
source "qemu" "ubuntu24" {
boot_wait = "2s"
boot_command = ["e<wait><down><down><down><end> autoinstall 'ds=nocloud;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/'<F10>"]
headless = false
communicator = "ssh"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "30m"
# qemu boilerplate
accelerator = "kvm"
cpus = 2
disk_interface = "virtio-scsi"
disk_size = "6G"
disk_compression = true
format = "qcow2"
machine_type = "q35"
memory = 4096
net_device = "virtio-net"
output_directory = "output/packer"
shutdown_command = "sudo -S shutdown -P now"
efi_boot = false
qemuargs = [
["-cpu", "host"]
]
iso_url = "https://releases.ubuntu.com/24.04.1/ubuntu-24.04.1-live-server-amd64.iso"
iso_checksum = "e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9"
http_directory = "http"
}
build {
sources = ["source.qemu.ubuntu24"]
provisioner "shell" {
execute_command="sudo -S env {{ .Vars }} {{ .Path }}"
scripts = [
"scripts/packer.sh"
]
}
post-processor "vagrant" {
keep_input_artifact = true
provider_override = "libvirt"
output = "output/packer/ubuntu24.box"
}
}