-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian11.pkr.hcl
93 lines (78 loc) · 2.38 KB
/
debian11.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
variable "config_file" {
type = string
default = "debian-preseed.cfg"
}
variable "cpu" {
type = string
default = "2"
}
variable "disk_size" {
type = string
default = "40000"
}
variable "headless" {
type = string
default = "true"
}
variable "iso_checksum" {
type = string
default = "sha256:23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66"
}
variable "iso_url" {
type = string
default = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso"
}
variable "name" {
type = string
default = "debian"
}
variable "ram" {
type = string
default = "2048"
}
variable "ssh_password" {
type = string
default = "testtest"
}
variable "ssh_username" {
type = string
default = "root"
}
variable "version" {
type = string
default = "11"
}
source "qemu" "debian11" {
accelerator = "kvm"
boot_command = ["<esc><wait>", "auto <wait>", "console-keymaps-at/keymap=us <wait>", "console-setup/ask_detect=false <wait>", "debconf/frontend=noninteractive <wait>", "debian-installer=en_US <wait>", "fb=false <wait>", "install <wait>", "kbd-chooser/method=us <wait>", "keyboard-configuration/xkb-keymap=us <wait>", "locale=en_US <wait>", "netcfg/get_hostname=${var.name}${var.version} <wait>", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/http/${var.config_file} <wait>", "<enter><wait>"]
boot_wait = "15s"
disk_cache = "none"
disk_compression = true
disk_discard = "unmap"
disk_interface = "virtio"
disk_size = var.disk_size
format = "qcow2"
headless = var.headless
host_port_max = 2229
host_port_min = 2222
http_directory = "."
http_port_max = 10089
http_port_min = 10082
iso_checksum = var.iso_checksum
iso_url = var.iso_url
net_device = "virtio-net"
output_directory = "artifacts/qemu/${var.name}${var.version}"
qemu_binary = "/usr/bin/qemu-system-x86_64"
qemuargs = [["-m", "${var.ram}M"], ["-smp", "${var.cpu}"]]
shutdown_command = "echo '${var.ssh_password}' | sudo -S shutdown -P now"
ssh_password = var.ssh_password
ssh_username = var.ssh_username
ssh_wait_timeout = "30m"
}
build {
sources = ["source.qemu.debian11"]
provisioner "shell" {
execute_command = "{{ .Vars }} bash '{{ .Path }}'"
inline = ["apt -y install python3"]
}
}