fastrabbit/packer/linux/debian-12-x64/debian-12-x64.pkr.hcl

74 lines
2.0 KiB
HCL

packer {
required_version = ">= 1.11.0"
required_plugins {
vsphere = {
source = "github.com/hashicorp/vsphere"
version = ">= 1.4.0"
}
ansible = {
source = "github.com/hashicorp/ansible"
version = ">= 1.1.1"
}
git = {
source = "github.com/ethanmdavidson/git"
version = ">= 0.6.2"
}
}
}
// Defines the local variables.
//locals {
// var1 = "var1"
//}
source "vsphere-iso" "debian-12" {
vcenter_server = var.vcenter_server
username = var.vcenter_username
password = var.vcenter_password
insecure_connection = true
datacenter = var.vcenter_datacenter
cluster = var.vcenter_cluster
host = var.vcenter_host
datastore = var.vcenter_datastore
folder = var.vcenter_folder
# convert_to_template = true
// ****************
vm_name = var.vm_name
CPUs = var.vm_num_cpu
RAM = var.vm_ram
vm_version = var.vm_hardware_version
guest_os_type = var.vm_guest_os_type
disk_controller_type = ["pvscsi"]
storage {
disk_size = var.vm_disk_size
disk_thin_provisioned = true
}
network_adapters {
network = var.vm_network
network_card = var.vm_network_nic_type
}
// ****************
ssh_username = var.connection_username
ssh_password = var.connection_password
ssh_port = "22"
ip_wait_timeout = "15m"
ssh_timeout = "10m"
ssh_handshake_attempts = "20"
shutdown_timeout = "15m"
// ****************
iso_checksum = var.iso_checksum
// iso_url = var.os_iso_url
iso_paths = [var.os_iso_paths]
// ****************
boot_wait = "5s"
boot_command = [var.boot_command]
}
build {
name = "template"
sources = ["source.vsphere-iso.debian-12"]
}