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

95 lines
2.3 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" "rocky9" {
iso_checksum = "e20445907daefbfcdb05ba034e9fc4cf91e0e8dc164ebd7266ffb8fdd8ea99e7"
iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.4-x86_64-dvd.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"
// Shutdown configuration
shutdown_command = "systemctl poweroff"
// Boot configuration
boot_command = ["<up><wait><tab> inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/inst.ks<enter>"]
boot_wait = "10s"
# Change this to match the ISO of ubuntu you are using in the iso_url variable
clone_template = "Rocky Linux 9"
vm_name = "Rocky Linux 9.4 template"
vm_description = "Rocky Linux 9.4 Packer template"
vcpus_max = 2
vcpus_atstartup = 2
vm_memory = 2048 #MB
network_names = ["prod_eth2"]
disk_size = 20480 #MB
disk_name = "rocky 9.4 disk"
vm_tags = ["Generated by Packer"]
ssh_username = "root"
ssh_password = "Packer"
ssh_wait_timeout = "60000s"
ssh_handshake_attempts = 10000
output_directory = "packer-rocky-9"
keep_vm = "on_success"
format = "xva_compressed"
}
build {
sources = ["xenserver-iso.rocky9"]
provisioner "shell" {
scripts = [
"scripts/rocky9_provisioning.sh"
]
}
}