Refactor Packer configuration for Debian 13 Trixie and add preseed file for automated installation
This commit is contained in:
parent
59840b928f
commit
d73702215d
2 changed files with 111 additions and 111 deletions
220
debian/13-trixie/debian-trixie.pkr.hcl
vendored
220
debian/13-trixie/debian-trixie.pkr.hcl
vendored
|
|
@ -1,133 +1,133 @@
|
||||||
packer {
|
packer {
|
||||||
required_plugins {
|
required_plugins {
|
||||||
proxmox = {
|
proxmox = {
|
||||||
version = "~> 1"
|
version = "~> 1"
|
||||||
source = "github.com/hashicorp/proxmox"
|
source = "github.com/hashicorp/proxmox"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
source "proxmox-iso" "debian-13-trixie" {
|
source "proxmox-iso" "debian-13-trixie" {
|
||||||
# Proxmox Connection Settings
|
# Proxmox Connection Settings
|
||||||
proxmox_url = "${var.proxmox_api_url}"
|
proxmox_url = "${var.proxmox_api_url}"
|
||||||
username = "${var.proxmox_api_token_id}"
|
username = "${var.proxmox_api_token_id}"
|
||||||
token = "${var.proxmox_api_token_secret}"
|
token = "${var.proxmox_api_token_secret}"
|
||||||
|
|
||||||
# Skip TLS Verification
|
# Skip TLS Verification
|
||||||
insecure_skip_tls_verify = "${var.proxmox_skip_tls_verify}"
|
insecure_skip_tls_verify = "${var.proxmox_skip_tls_verify}"
|
||||||
|
|
||||||
# VM General Settings
|
# VM General Settings
|
||||||
node = "${var.proxmox_node}"
|
node = "${var.proxmox_node}"
|
||||||
vm_id = "${var.template_vm_id}"
|
vm_id = "${var.template_vm_id}"
|
||||||
vm_name = "debian-13-trixie-${local.timestamp}"
|
vm_name = "debian-13-trixie-${local.timestamp}"
|
||||||
template_description = "Debian 13 Trixie, built with Packer on ${local.timestamp}"
|
template_description = "Debian 13 Trixie, built with Packer on ${local.timestamp}"
|
||||||
os = "l26"
|
os = "l26"
|
||||||
qemu_agent = true
|
qemu_agent = true
|
||||||
|
|
||||||
# VM Hardware Settings
|
# VM Hardware Settings
|
||||||
machine = "q35"
|
machine = "q35"
|
||||||
cpu_type = "${var.template_cpu_type}"
|
cpu_type = "${var.template_cpu_type}"
|
||||||
cores = 2
|
cores = 2
|
||||||
memory = 2048
|
memory = 2048
|
||||||
bios = "ovmf"
|
bios = "ovmf"
|
||||||
scsi_controller = "virtio-scsi-pci"
|
scsi_controller = "virtio-scsi-pci"
|
||||||
disks {
|
disks {
|
||||||
disk_size = "20G"
|
disk_size = "20G"
|
||||||
format = "qcow2"
|
format = "qcow2"
|
||||||
storage_pool = "${var.disk_storage_pool}"
|
storage_pool = "${var.disk_storage_pool}"
|
||||||
type = "virtio"
|
type = "virtio"
|
||||||
}
|
}
|
||||||
|
|
||||||
efi_config {
|
efi_config {
|
||||||
efi_storage_pool = "${var.disk_storage_pool}"
|
efi_storage_pool = "${var.disk_storage_pool}"
|
||||||
pre_enrolled_keys = true
|
pre_enrolled_keys = true
|
||||||
efi_format = "raw"
|
efi_format = "raw"
|
||||||
efi_type = "4m"
|
efi_type = "4m"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download ISO
|
# Download ISO
|
||||||
boot_iso {
|
boot_iso {
|
||||||
type = "scsi"
|
type = "scsi"
|
||||||
iso_url = "${var.iso_url}"
|
iso_url = "${var.iso_url}"
|
||||||
unmount = true
|
unmount = true
|
||||||
iso_storage_pool = "${var.iso_storage_pool}"
|
iso_storage_pool = "${var.iso_storage_pool}"
|
||||||
iso_checksum = "${var.iso_checksum}"
|
iso_checksum = "${var.iso_checksum}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# VM Network Settings
|
# VM Network Settings
|
||||||
network_adapters {
|
network_adapters {
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
mac_address = "${var.mac_address}"
|
mac_address = "${var.mac_address}"
|
||||||
bridge = "${var.network_bridge}"
|
bridge = "${var.network_bridge}"
|
||||||
firewall = "false"
|
firewall = "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
# VM Cloud-Init Settings
|
# VM Cloud-Init Settings
|
||||||
cloud_init = true
|
cloud_init = true
|
||||||
cloud_init_storage_pool = "${var.disk_storage_pool}"
|
cloud_init_storage_pool = "${var.disk_storage_pool}"
|
||||||
cloud_init_disk_type = "scsi"
|
cloud_init_disk_type = "scsi"
|
||||||
|
|
||||||
# PACKER Boot Commands
|
# PACKER Boot Commands
|
||||||
boot = "order=virtio0;scsi0"
|
boot = "order=virtio0;scsi0"
|
||||||
boot_wait = "10s"
|
boot_wait = "10s"
|
||||||
communicator = "ssh"
|
communicator = "ssh"
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"<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 preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg noprompt<enter>",
|
"DEBIAN_FRONTEND=text preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg noprompt<enter>",
|
||||||
"initrd /install.amd/initrd.gz<enter>",
|
"initrd /install.amd/initrd.gz<enter>",
|
||||||
"DEBCONF_DEBUG=5<enter>",
|
"DEBCONF_DEBUG=5<enter>",
|
||||||
"boot<enter>"
|
"boot<enter>"
|
||||||
]
|
]
|
||||||
|
|
||||||
# PACKER Autoinstall Settings
|
# PACKER Autoinstall Settings
|
||||||
http_directory = "debian/13-trixie/http"
|
http_directory = "debian/13-trixie/http"
|
||||||
|
|
||||||
# SSH Settings
|
# SSH Settings
|
||||||
ssh_username = "root"
|
ssh_username = "root"
|
||||||
ssh_password = "packer"
|
ssh_password = "packer"
|
||||||
ssh_timeout = "20m"
|
ssh_timeout = "20m"
|
||||||
ssh_pty = true
|
ssh_pty = true
|
||||||
}
|
}
|
||||||
|
|
||||||
build {
|
build {
|
||||||
name = "debian-13-trixie-image"
|
name = "debian-13-trixie-image"
|
||||||
sources = ["source.proxmox-iso.debian-13-trixie"]
|
sources = ["source.proxmox-iso.debian-13-trixie"]
|
||||||
|
|
||||||
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
|
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = [
|
inline = [
|
||||||
"rm /etc/ssh/ssh_host_*",
|
"rm /etc/ssh/ssh_host_*",
|
||||||
"truncate -s 0 /etc/machine-id",
|
"truncate -s 0 /etc/machine-id",
|
||||||
"apt -y autoremove --purge 2> /dev/null",
|
"apt -y autoremove --purge 2> /dev/null",
|
||||||
"apt -y clean 2> /dev/null",
|
"apt -y clean 2> /dev/null",
|
||||||
"apt -y autoclean 2> /dev/null",
|
"apt -y autoclean 2> /dev/null",
|
||||||
"cloud-init clean",
|
"cloud-init clean",
|
||||||
"rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
"rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg",
|
||||||
"rm -rf /var/cache/apt/archives /var/lib/apt/lists/*",
|
"rm -rf /var/cache/apt/archives /var/lib/apt/lists/*",
|
||||||
"sync"
|
"sync"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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/files/99-pve.cfg"
|
source = "debian/13-trixie/files/99-pve.cfg"
|
||||||
destination = "/tmp/99-pve.cfg"
|
destination = "/tmp/99-pve.cfg"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #3
|
# Provisioning the VM Template for Cloud-Init Integration in Proxmox #3
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = ["sudo cp /tmp/99-pve.cfg /etc/cloud/cloud.cfg.d/99-pve.cfg"]
|
inline = ["sudo cp /tmp/99-pve.cfg /etc/cloud/cloud.cfg.d/99-pve.cfg"]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove CD-ROM entries from APT sources list
|
# Remove CD-ROM entries from APT sources list
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = ["sed -i '/cdrom/d' /etc/apt/sources.list"]
|
inline = ["sed -i '/cdrom/d' /etc/apt/sources.list"]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add custom APT sources list
|
# Add custom APT sources list
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
source = "debian/13-trixie/files/debian.sources"
|
source = "debian/13-trixie/files/debian.sources"
|
||||||
destination = "/etc/apt/sources.list.d/debian.sources"
|
destination = "/etc/apt/sources.list.d/debian.sources"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ popularity-contest popularity-contest/participate boolean false
|
||||||
|
|
||||||
### Mirror settings
|
### Mirror settings
|
||||||
d-i mirror/country string manual
|
d-i mirror/country string manual
|
||||||
d-i mirror/http/hostname string http.us.debian.org
|
d-i mirror/http/hostname string ftp.de.debian.org
|
||||||
d-i mirror/http/directory string /debian
|
d-i mirror/http/directory string /debian
|
||||||
d-i mirror/http/proxy string
|
d-i mirror/http/proxy string
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue