-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian-12.pkr.hcl
90 lines (80 loc) · 2.26 KB
/
debian-12.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
source "qemu" "debian12" {
iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.8.0-amd64-netinst.iso"
iso_checksum = "file:https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA256SUMS"
vga = "virtio"
cpus = 2
memory = 4096
headless = var.headless
shutdown_command = "shutdown -P now"
qmp_enable = true
disk_discard = "unmap"
http_content = {
"/debian-preseed.cfg" = templatefile("${path.root}/debian-preseed.cfg", { path = path, hostname = "debian12" })
}
ssh_timeout = "1h"
ssh_username = "root"
ssh_password = "vagrant"
boot_command = [
"<esc><wait><esc><wait><esc><wait><esc><wait><esc><wait><esc><wait>",
"<esc><wait><esc><wait><esc><wait><esc><wait><esc><wait><esc><wait>",
"/install.amd/vmlinuz console=ttyS0 ",
"auto=true DEBIAN_FRONTEND=text TERM=dumb debconf/priority=critical ",
"keyboard-configuration/xkb-keymap=en ",
"initrd=/install.amd/initrd.gz --- ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/debian-preseed.cfg ",
"<enter>"
]
qemuargs = [["-serial", "stdio"]]
}
build {
sources = [
"source.qemu.debian12"
]
provisioner "shell" {
inline = [
"echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >/etc/sudoers.d/vagrant",
"chmod 0440 /etc/sudoers.d/vagrant"
]
}
provisioner "shell" {
inline = [
"mkdir -p /home/vagrant/.ssh",
"chmod 700 /home/vagrant/.ssh",
"chown -R vagrant:vagrant /home/vagrant/.ssh",
]
}
provisioner "file" {
source = "${path.root}/keys/vagrant.pub"
destination = "/home/vagrant/.ssh/authorized_keys"
}
provisioner "shell" {
inline = [
"chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys",
"chmod 644 /home/vagrant/.ssh/authorized_keys",
]
}
provisioner "shell" {
inline = [
"mkdir -p /root/.ssh",
"chmod 700 /root/.ssh",
]
}
provisioner "file" {
source = "${path.root}/keys/vagrant.pub"
destination = "/root/.ssh/authorized_keys"
}
provisioner "shell" {
inline = [
"apt-get clean -y",
]
}
post-processors {
post-processor "vagrant" {
vagrantfile_template = "Vagrantfile"
}
post-processor "vagrant-registry" {
box_tag = "gnome-shell-box/debian12"
version = local.version
}
}
}