forked from eaksel/packer-Debian11
-
Notifications
You must be signed in to change notification settings - Fork 1
/
debian.pkr.hcl
75 lines (63 loc) · 1.85 KB
/
debian.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
variable "kubernetes_major" {
type = string
default = "1"
}
variable "kubernetes_minor" {
type = string
default = "28"
}
variable "boot_wait" {
type = string
default = "5s"
}
variable "disk_size" {
type = string
default = "4G"
}
variable "headless" {
type = string
default = "true"
}
variable "image_name" {
type = string
default = "debian-12-genericcloud-amd64-daily.qcow2"
}
variable "iso_base_url" {
type = string
default = "https://cdimage.debian.org/cdimage/cloud/bookworm/daily/latest"
}
variable "numvcpus" {
type = string
default = "1"
}
source "qemu" "debian" {
accelerator = "kvm"
boot_wait = "${var.boot_wait}"
disk_compression = true
disk_image = true
disk_interface = "virtio"
disk_size = "${var.disk_size}"
format = "qcow2"
headless = "${var.headless}"
http_content = {
"/cloud-init/user-data" = templatefile("${path.root}/http/cloud-init/user-data", { kubernetes_major = "${var.kubernetes_major}", kubernetes_minor = "${var.kubernetes_minor}" } )
"/cloud-init/meta-data" = file("http/cloud-init/meta-data")
}
iso_checksum = "file:${var.iso_base_url}/SHA512SUMS"
iso_url = "${var.iso_base_url}/${var.image_name}"
net_device = "virtio-net"
qemuargs = [["-smbios", "type=1,serial=ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/cloud-init/"]]
shutdown_command = "echo 'packer'|sudo systemctl poweroff "
ssh_password = "packer"
ssh_port = 22
ssh_timeout = "5m"
ssh_username = "debian"
vm_name = "proxmox-k8s-${var.kubernetes_major}.${var.kubernetes_minor}.qcow2"
}
build {
sources = ["source.qemu.debian"]
provisioner "shell" {
execute_command = "echo 'packer'|{{ .Vars }} sudo -S -E bash '{{ .Path }}'"
scripts = ["scripts/cleanup.sh"]
}
}