2024-07-15 17:12:00 +02:00
|
|
|
# packer
|
|
|
|
packer {
|
|
|
|
required_plugins {
|
|
|
|
proxmox = {
|
|
|
|
version = ">=1.1.8"
|
|
|
|
source = "github.com/hashicorp/proxmox"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# variables
|
|
|
|
variable "proxmox_iso_pool" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_node" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_password" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_storage_format" {
|
|
|
|
type = string
|
|
|
|
default = "raw"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_storage_pool" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_storage_pool_type" {
|
|
|
|
type = string
|
|
|
|
default = "rbd"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_url" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "proxmox_username" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "template_description" {
|
|
|
|
type = string
|
|
|
|
default = "Debian 12 Bookworm Template"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "template_name" {
|
|
|
|
type = string
|
|
|
|
default = "debian.template.siempie.internal"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "template_username" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "template_password" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "iso_image" {
|
|
|
|
type = string
|
|
|
|
default = "debian-12.5.0-amd64-netinst.iso"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "version" {
|
|
|
|
type = string
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# builder
|
|
|
|
source "proxmox-iso" "template" {
|
|
|
|
|
|
|
|
# boot
|
|
|
|
boot_command = ["<esc><wait>auto url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<enter>"]
|
|
|
|
boot_wait = "10s"
|
|
|
|
|
|
|
|
# specs
|
|
|
|
cores = "2"
|
|
|
|
memory = "4096"
|
|
|
|
|
|
|
|
# storage
|
|
|
|
disks {
|
|
|
|
disk_size = "20G"
|
|
|
|
format = "${var.proxmox_storage_format}"
|
|
|
|
storage_pool = "${var.proxmox_storage_pool}"
|
|
|
|
type = "virtio"
|
2024-07-16 16:53:22 +02:00
|
|
|
cache_mode = "unsafe"
|
2024-07-15 17:12:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# networking
|
|
|
|
network_adapters {
|
|
|
|
bridge = "vmbr0"
|
|
|
|
}
|
|
|
|
|
|
|
|
# misc
|
|
|
|
http_directory = "debian12/http"
|
|
|
|
insecure_skip_tls_verify = true
|
|
|
|
iso_file = "${var.proxmox_iso_pool}/${var.iso_image}"
|
|
|
|
node = "${var.proxmox_node}"
|
|
|
|
vm_id = "998"
|
|
|
|
tags = "mgmt"
|
|
|
|
os = "l26"
|
|
|
|
password = "${var.proxmox_password}"
|
|
|
|
proxmox_url = "${var.proxmox_url}"
|
|
|
|
scsi_controller = "virtio-scsi-single"
|
|
|
|
ssh_port = 22
|
|
|
|
ssh_timeout = "20m"
|
2024-07-15 17:19:39 +02:00
|
|
|
ssh_username = "root"
|
2024-07-15 17:12:00 +02:00
|
|
|
ssh_password = "${var.template_password}"
|
2024-08-20 11:20:57 +02:00
|
|
|
template_description = "${var.template_description} - Created on ${formatdate("DD-MM-YYYY", timestamp())}"
|
2024-07-15 17:12:00 +02:00
|
|
|
template_name = "${var.template_name}"
|
|
|
|
unmount_iso = true
|
|
|
|
username = "${var.proxmox_username}"
|
|
|
|
}
|
|
|
|
|
|
|
|
build {
|
|
|
|
sources = ["source.proxmox-iso.template"]
|
|
|
|
provisioner "shell" {
|
|
|
|
script = "scripts/debian12.sh"
|
|
|
|
}
|
|
|
|
}
|