xcp-ng/packer/debian12/debian12.pkr.hcl
2024-09-19 09:18:24 +02:00

94 lines
2.4 KiB
HCL

packer {
required_plugins {
xenserver= {
version = "= v0.7.3"
source = "github.com/ddelnano/xenserver"
}
}
}
variable "remote_host" {
type = string
description = "The ip or fqdn of your XCP-ng. It must be the master"
sensitive = true
default = "<edited>"
}
variable "remote_username" {
type = string
description = "The username used to interact with your XCP-ng"
sensitive = true
default = "<edited>"
}
variable "remote_password" {
type = string
description = "The password used to interact with your XCP-ng"
sensitive = true
default = "<edited>"
}
variable "sr_iso_name" {
type = string
description = "The ISO-SR to packer will use"
default = "<edited>"
}
variable "sr_name" {
type = string
description = "The name of the SR to packer will use"
default = "<edited>"
}
source "xenserver-iso" "debian12" {
iso_checksum = "8fde79cfc6b20a696200fc5c15219cf6d721e8feb367e9e0e33a79d1cb68fa83"
iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.7.0-amd64-netinst.iso"
sr_iso_name = var.sr_iso_name
sr_name = var.sr_name
tools_iso_name = ""
remote_host = var.remote_host
remote_password = var.remote_password
remote_username = var.remote_username
http_directory = "http"
ip_getter = "tools"
boot_command = [
"<wait><wait><wait><esc><wait><wait><wait>",
"/install.amd/vmlinuz ",
"initrd=/install.amd/initrd.gz ",
"auto=true ",
"domain= ",
"url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
"hostname=debian ",
"interface=auto ",
"vga=788 noprompt quiet--- <enter>"
]
# Change this to match the ISO of ubuntu you are using in the iso_url variable
clone_template = "Debian Bookworm 12"
vm_name = "Debian 12 template test"
vm_description = "My first template with packer"
vcpus_max = 2
vcpus_atstartup = 2
vm_memory = 2048 #MB
network_names = ["prod_eth2"]
disk_size = 20480 #MB
disk_name = "debian 12 disk"
vm_tags = ["Generated by Packer"]
ssh_username = "debian"
ssh_password = "debian"
ssh_wait_timeout = "60000s"
ssh_handshake_attempts = 10000
output_directory = "packer-debian-12"
keep_vm = "never"
format = "xva_compressed"
}
build {
sources = ["xenserver-iso.debian12"]
}