110 lines
2.5 KiB
HCL
110 lines
2.5 KiB
HCL
|
packer {
|
||
|
required_plugins {
|
||
|
proxmox = {
|
||
|
version = ">=1.1.7"
|
||
|
source = "github.com/hashicorp/proxmox"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
variable "proxmox_iso_pool" {
|
||
|
type = string
|
||
|
default = "cracky-fs-images:iso"
|
||
|
}
|
||
|
|
||
|
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 = "cracky-fs"
|
||
|
}
|
||
|
|
||
|
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 = "Ubuntu 24.04 Template"
|
||
|
}
|
||
|
|
||
|
variable "template_name" {
|
||
|
type = string
|
||
|
default = "template.test.siempie.internal"
|
||
|
}
|
||
|
|
||
|
variable "ubuntu_image" {
|
||
|
type = string
|
||
|
default = "ubuntu-24.04-live-server-amd64.iso"
|
||
|
}
|
||
|
|
||
|
variable "version" {
|
||
|
type = string
|
||
|
default = ""
|
||
|
}
|
||
|
|
||
|
source "proxmox-iso" "template" {
|
||
|
boot_command = ["c", "linux /casper/vmlinuz -- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/'", "<enter><wait><wait>", "initrd /casper/initrd", "<enter><wait><wait>", "boot<enter>"]
|
||
|
boot_wait = "10s"
|
||
|
cores = "2"
|
||
|
disks {
|
||
|
disk_size = "20G"
|
||
|
format = "${var.proxmox_storage_format}"
|
||
|
storage_pool = "${var.proxmox_storage_pool}"
|
||
|
type = "virtio"
|
||
|
}
|
||
|
http_directory = "ubuntu24/http"
|
||
|
insecure_skip_tls_verify = true
|
||
|
iso_file = "${var.proxmox_iso_pool}/${var.ubuntu_image}"
|
||
|
memory = "2048"
|
||
|
network_adapters {
|
||
|
bridge = "vmbr0"
|
||
|
}
|
||
|
node = "${var.proxmox_node}"
|
||
|
vm_id = "999"
|
||
|
tags = "mgmt"
|
||
|
os = "l26"
|
||
|
password = "${var.proxmox_password}"
|
||
|
proxmox_url = "${var.proxmox_url}"
|
||
|
scsi_controller = "virtio-scsi-single"
|
||
|
ssh_port = 22
|
||
|
ssh_timeout = "10m"
|
||
|
ssh_username = "${var.template_username}"
|
||
|
ssh_password = "${var.template_password}"
|
||
|
template_description = "${var.template_description}"
|
||
|
template_name = "${var.template_name}"
|
||
|
unmount_iso = true
|
||
|
username = "${var.proxmox_username}"
|
||
|
}
|
||
|
|
||
|
build {
|
||
|
sources = ["source.proxmox-iso.template"]
|
||
|
provisioner "shell" {
|
||
|
script = "scripts/magic.sh"
|
||
|
}
|
||
|
}
|