105 lines
2.9 KiB
HCL
105 lines
2.9 KiB
HCL
packer {
|
|
required_plugins {
|
|
name = {
|
|
version = "~> 1"
|
|
source = "github.com/hashicorp/proxmox"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "proxmox_api_token_id" {
|
|
type = string
|
|
}
|
|
|
|
variable "proxmox_api_token_secret" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "proxmox_api_url" {
|
|
type = string
|
|
}
|
|
|
|
variable "proxmox_node" {
|
|
type = string
|
|
}
|
|
|
|
|
|
locals {
|
|
packer_timestamp = formatdate("YYYYMMDD-hhmm", timestamp())
|
|
storage_pool = "local-zfs"
|
|
vm_name = "pckr-deb12"
|
|
}
|
|
|
|
source "proxmox-iso" "debian12" {
|
|
bios = "ovmf"
|
|
boot_command = [
|
|
"<wait><wait><wait>c<wait><wait><wait>",
|
|
"linux /install.amd/vmlinuz ",
|
|
"auto=true ",
|
|
"url=https://git.cloud.arnaud-pc.fr/ministicraft/packer-ministack/raw/branch/master/autoinstall/preseed.cfg ",
|
|
"hostname=${local.vm_name} ",
|
|
"domain=arnaud-pc.local ",
|
|
"interface=auto ",
|
|
"vga=788 noprompt quiet --<enter>",
|
|
"initrd /install.amd/initrd.gz<enter>",
|
|
"boot<enter>"
|
|
]
|
|
boot_wait = "10s"
|
|
cloud_init = true
|
|
cloud_init_storage_pool = local.storage_pool
|
|
communicator = "ssh"
|
|
cores = 1
|
|
cpu_type = "x86-64-v3"
|
|
insecure_skip_tls_verify = true
|
|
iso_checksum = "sha512:33c08e56c83d13007e4a5511b9bf2c4926c4aa12fd5dd56d493c0653aecbab380988c5bf1671dbaea75c582827797d98c4a611f7fb2b131fbde2c677d5258ec9"
|
|
iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
|
|
iso_storage_pool = "local"
|
|
iso_download_pve = true
|
|
machine = "q35"
|
|
memory = 2048
|
|
node = "pve3"
|
|
os = "l26"
|
|
proxmox_url = "${var.proxmox_api_url}"
|
|
qemu_agent = true
|
|
scsi_controller = "virtio-scsi-pci"
|
|
sockets = 1
|
|
ssh_handshake_attempts = 6
|
|
ssh_pty = true
|
|
ssh_timeout = "10m"
|
|
ssh_username = "debian"
|
|
ssh_private_key_file = "/home/ministicraft/.ssh/id_ed25519"
|
|
tags = "debian-12;template"
|
|
template_description = "Debian 12 Packer Template - ${local.packer_timestamp}"
|
|
token = "${var.proxmox_api_token_secret}"
|
|
unmount_iso = true
|
|
username = "${var.proxmox_api_token_id}"
|
|
vm_id = 99998
|
|
vm_name = local.vm_name
|
|
pool = "packer"
|
|
|
|
efi_config {
|
|
efi_storage_pool = "${local.storage_pool}"
|
|
pre_enrolled_keys = false
|
|
efi_type = "4m"
|
|
}
|
|
|
|
disks {
|
|
discard = true
|
|
disk_size = "12G"
|
|
format = "raw"
|
|
io_thread = false
|
|
storage_pool = "${local.storage_pool}"
|
|
type = "scsi"
|
|
}
|
|
|
|
network_adapters {
|
|
bridge = "vmbr0"
|
|
firewall = false
|
|
model = "virtio"
|
|
}
|
|
}
|
|
|
|
build {
|
|
sources = ["source.proxmox-iso.debian12"]
|
|
} |