Refactor Debian 13 Trixie Packer templates for LUKS support
- Removed obsolete variable files: variables-common.pkr.hcl and variables.pkr.hcl. - Updated debian-trixie.pkr.hcl to include local values for LUKS configuration. - Modified boot command to include LUKS arguments based on the enable_luks variable. - Enhanced initial-setup.sh to support LUKS detection and resizing. - Replaced preseed.cfg with preseed.cfg.pkrtpl for dynamic LUKS configuration. - Added enable_luks variable to control LUKS encryption during image build. - Introduced luks.pkrvars.hcl for LUKS-specific variable settings. - Updated mise.toml to support new variable file argument for Packer builds.
This commit is contained in:
parent
e57f2d977b
commit
eded7180dc
20 changed files with 281 additions and 2445 deletions
59
debian/13-trixie/debian-trixie.pkr.hcl
vendored
59
debian/13-trixie/debian-trixie.pkr.hcl
vendored
|
|
@ -7,6 +7,20 @@ packer {
|
|||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
image_slug = var.enable_luks ? "debian-13-trixie-luks" : "debian-13-trixie"
|
||||
template_description = var.enable_luks ? "Debian 13 Trixie, LUKS encrypted, built with Packer on ${local.timestamp}\n\nLUKS default passphrase: `${var.default_luks_passphrase}`" : "Debian 13 Trixie, built with Packer on ${local.timestamp}"
|
||||
luks_boot_args = var.enable_luks ? [
|
||||
"partman-crypto/passphrase='${var.default_luks_passphrase}' ",
|
||||
"partman-crypto/passphrase-again='${var.default_luks_passphrase}' ",
|
||||
"INSTALL_FINISHED_INFORM_URL='http://{{ .HTTPIP }}:${var.install_finished_inform_port}/install_finished' ",
|
||||
] : []
|
||||
clevis_install_commands = var.enable_luks ? [
|
||||
"apt-get update",
|
||||
"apt-get install -y clevis clevis-luks clevis-initramfs",
|
||||
] : ["true"]
|
||||
}
|
||||
|
||||
source "proxmox-iso" "debian-13-trixie" {
|
||||
# Proxmox Connection Settings
|
||||
proxmox_url = "${var.proxmox_api_url}"
|
||||
|
|
@ -19,8 +33,8 @@ source "proxmox-iso" "debian-13-trixie" {
|
|||
# VM General Settings
|
||||
node = "${var.proxmox_node}"
|
||||
vm_id = "${var.template_vm_id}"
|
||||
vm_name = "debian-13-trixie-${local.timestamp}"
|
||||
template_description = "Debian 13 Trixie, built with Packer on ${local.timestamp}"
|
||||
vm_name = "${local.image_slug}-${local.timestamp}"
|
||||
template_description = "${local.template_description}"
|
||||
os = "l26"
|
||||
qemu_agent = true
|
||||
|
||||
|
|
@ -78,42 +92,26 @@ source "proxmox-iso" "debian-13-trixie" {
|
|||
boot = "order=scsi0;scsi1"
|
||||
boot_wait = "10s"
|
||||
communicator = "ssh"
|
||||
boot_command = [
|
||||
boot_command = concat([
|
||||
"<wait3>c<wait3>",
|
||||
"linux /install.amd/vmlinuz auto-install/enable=true priority=critical ",
|
||||
"DEBIAN_FRONTEND=text ",
|
||||
"console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 ",
|
||||
"passwd/root-password='${var.default_root_passphrase}' ",
|
||||
"passwd/root-password-again='${var.default_root_passphrase}' ",
|
||||
], local.luks_boot_args, [
|
||||
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg noprompt<enter>",
|
||||
"initrd /install.amd/initrd.gz<enter>",
|
||||
"DEBCONF_DEBUG=5<enter>",
|
||||
"boot<enter>"
|
||||
]
|
||||
# Static IP
|
||||
# boot_command = [
|
||||
# "<wait3>c<wait3>",
|
||||
# "linux /install.amd/vmlinuz auto-install/enable=true priority=critical ",
|
||||
# "DEBIAN_FRONTEND=text ",
|
||||
# "console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 ",
|
||||
# "passwd/root-password='${var.default_root_passphrase}' ",
|
||||
# "passwd/root-password-again='${var.default_root_passphrase}' ",
|
||||
# "netcfg/disable_autoconfig=true ",
|
||||
# "netcfg/get_ipaddress=172.16.2.254 ",
|
||||
# "netcfg/get_netmask=255.255.255.0 ",
|
||||
# "netcfg/get_gateway=172.16.2.3 ",
|
||||
# "netcfg/get_nameservers=172.16.2.3 ",
|
||||
# "netcfg/confirm_static=true ",
|
||||
# "netcfg/get_hostname=debian-installer ",
|
||||
# "netcfg/get_domain=local ",
|
||||
# "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg noprompt<enter>",
|
||||
# "initrd /install.amd/initrd.gz<enter>",
|
||||
# "DEBCONF_DEBUG=5<enter>",
|
||||
# "boot<enter>"
|
||||
# ]
|
||||
"boot<enter>",
|
||||
])
|
||||
|
||||
# PACKER Autoinstall Settings
|
||||
http_directory = "debian/13-trixie/http"
|
||||
http_content = {
|
||||
"/preseed.cfg" = templatefile("${abspath(path.root)}/http/preseed.cfg.pkrtpl", {
|
||||
enable_luks = var.enable_luks
|
||||
})
|
||||
}
|
||||
http_interface = "${var.source_proxmox_http_interface}"
|
||||
|
||||
# SSH Settings
|
||||
|
|
@ -124,7 +122,7 @@ source "proxmox-iso" "debian-13-trixie" {
|
|||
}
|
||||
|
||||
build {
|
||||
name = "debian-13-trixie-image"
|
||||
name = "${local.image_slug}-image"
|
||||
sources = ["source.proxmox-iso.debian-13-trixie"]
|
||||
|
||||
# Install dependencies and default packages
|
||||
|
|
@ -197,6 +195,11 @@ build {
|
|||
]
|
||||
}
|
||||
|
||||
# Install Clevis for LUKS builds
|
||||
provisioner "shell" {
|
||||
inline = local.clevis_install_commands
|
||||
}
|
||||
|
||||
# Setup Serial Console for xterm.js in Proxmox VE
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue