Add serial console support and enhance provisioning scripts for Debian 13 Trixie LUKS template
This commit is contained in:
parent
ebffbbb548
commit
4142a521ba
1 changed files with 90 additions and 10 deletions
100
debian/13-trixie-luks/debian-trixie.pkr.hcl
vendored
100
debian/13-trixie-luks/debian-trixie.pkr.hcl
vendored
|
|
@ -45,6 +45,10 @@ source "proxmox-iso" "debian-13-trixie-luks" {
|
||||||
efi_type = "4m"
|
efi_type = "4m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serials = [
|
||||||
|
"socket"
|
||||||
|
]
|
||||||
|
|
||||||
# Download ISO
|
# Download ISO
|
||||||
boot_iso {
|
boot_iso {
|
||||||
type = "scsi"
|
type = "scsi"
|
||||||
|
|
@ -75,6 +79,7 @@ source "proxmox-iso" "debian-13-trixie-luks" {
|
||||||
"<wait3>c<wait3>",
|
"<wait3>c<wait3>",
|
||||||
"linux /install.amd/vmlinuz auto-install/enable=true priority=critical ",
|
"linux /install.amd/vmlinuz auto-install/enable=true priority=critical ",
|
||||||
"DEBIAN_FRONTEND=text ",
|
"DEBIAN_FRONTEND=text ",
|
||||||
|
"console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 ",
|
||||||
"passwd/root-password='${var.default_root_passphrase}' ",
|
"passwd/root-password='${var.default_root_passphrase}' ",
|
||||||
"passwd/root-password-again='${var.default_root_passphrase}' ",
|
"passwd/root-password-again='${var.default_root_passphrase}' ",
|
||||||
"partman-crypto/passphrase='${var.default_luks_passphrase}' ",
|
"partman-crypto/passphrase='${var.default_luks_passphrase}' ",
|
||||||
|
|
@ -101,21 +106,38 @@ build {
|
||||||
name = "debian-13-trixie-luks-image"
|
name = "debian-13-trixie-luks-image"
|
||||||
sources = ["source.proxmox-iso.debian-13-trixie-luks"]
|
sources = ["source.proxmox-iso.debian-13-trixie-luks"]
|
||||||
|
|
||||||
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
|
# Install dependencies and default packages
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = [
|
inline = [
|
||||||
"rm /etc/ssh/ssh_host_*",
|
"export DEBIAN_FRONTEND=noninteractive",
|
||||||
"truncate -s 0 /etc/machine-id",
|
"apt-get update",
|
||||||
"apt -y autoremove --purge 2> /dev/null",
|
"apt-get install -y age apt-transport-https aria2 bat bc bmon btop ca-certificates curl duf eza fastfetch fzf git gnupg htop iftop iotop iperf jq lsof magic-wormhole mosh mtr ncdu parted progress pv ripgrep rsync smartmontools socat sudo tmux usbutils vim wget yq zsh zstd"
|
||||||
"apt -y clean 2> /dev/null",
|
|
||||||
"apt -y autoclean 2> /dev/null",
|
|
||||||
"rm -rf /var/cache/apt/archives /var/lib/apt/lists/*",
|
|
||||||
"cloud-init clean",
|
|
||||||
"rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
|
||||||
"sync"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install Tailscale
|
||||||
|
provisioner "shell" {
|
||||||
|
script = "debian/13-trixie-luks/scripts/tailscale.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup CrowdSec Repo
|
||||||
|
provisioner "shell" {
|
||||||
|
script = "debian/13-trixie-luks/scripts/crowdsec-repo-setup.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install CrowdSec
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"apt-get install -y crowdsec",
|
||||||
|
"apt-get install -y crowdsec-firewall-bouncer-iptables"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure CrowdSec
|
||||||
|
provisioner "shell" {
|
||||||
|
script = "debian/13-trixie-luks/scripts/crowdsec-configuration.sh"
|
||||||
|
}
|
||||||
|
|
||||||
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
|
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
source = "debian/13-trixie-luks/files/99-pve.cfg"
|
source = "debian/13-trixie-luks/files/99-pve.cfg"
|
||||||
|
|
@ -137,4 +159,62 @@ build {
|
||||||
source = "debian/13-trixie-luks/files/debian.sources"
|
source = "debian/13-trixie-luks/files/debian.sources"
|
||||||
destination = "/etc/apt/sources.list.d/debian.sources"
|
destination = "/etc/apt/sources.list.d/debian.sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = "debian/13-trixie-luks/files/90-initial-login-setup.sh"
|
||||||
|
destination = "/etc/profile.d/90-initial-login-setup.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = "debian/13-trixie-luks/files/initial-setup.sh"
|
||||||
|
destination = "/usr/local/bin/initial-setup.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"chmod +x /usr/local/bin/initial-setup.sh"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install Clevis
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"apt-get update",
|
||||||
|
"apt-get install -y clevis clevis-luks clevis-initramfs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup Serial Console for xterm.js in Proxmox VE
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"sed -i 's/#\\?GRUB_CMDLINE_LINUX=.*\"/GRUB_CMDLINE_LINUX=\"console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0\"/' /etc/default/grub",
|
||||||
|
"sed -i 's/#\\?GRUB_TERMINAL=.*/GRUB_TERMINAL=\"serial console\"/' /etc/default/grub",
|
||||||
|
"sed -i 's/#\\?GRUB_SERIAL_COMMAND=.*/GRUB_SERIAL_COMMAND=\"serial --speed=115200\"/' /etc/default/grub",
|
||||||
|
"update-grub"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"rm /etc/ssh/ssh_host_*",
|
||||||
|
"truncate -s 0 /etc/machine-id",
|
||||||
|
"apt -y autoremove --purge 2> /dev/null",
|
||||||
|
"apt -y clean 2> /dev/null",
|
||||||
|
"apt -y autoclean 2> /dev/null",
|
||||||
|
"rm -rf /var/cache/apt/archives /var/lib/apt/lists/*",
|
||||||
|
"cloud-init clean",
|
||||||
|
"rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
||||||
|
"sync"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove temporary settings and configuration for packer build
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"sed -i 's/^#\\?PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config",
|
||||||
|
"sed -i 's/^#\\?PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config",
|
||||||
|
"passwd -dl root"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue