Finished packer scripts for Ubuntu 24.04
This commit is contained in:
87
packer/linux/ubuntu-24.04-x64/ubuntu-24.04-x64.pkr.hcl
Normal file
87
packer/linux/ubuntu-24.04-x64/ubuntu-24.04-x64.pkr.hcl
Normal file
@ -0,0 +1,87 @@
|
||||
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" "ubuntu-24-04-x64" {
|
||||
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_private_key_file = var.connection_ssh_private_key_file
|
||||
ssh_port = "22"
|
||||
ip_wait_timeout = "25m"
|
||||
ssh_timeout = "10m"
|
||||
ssh_handshake_attempts = "20"
|
||||
shutdown_timeout = "10m"
|
||||
// ****************
|
||||
iso_checksum = var.iso_checksum
|
||||
// iso_url = var.os_iso_url
|
||||
iso_paths = [var.os_iso_paths]
|
||||
// ****************
|
||||
|
||||
boot_wait = "8s"
|
||||
boot_command = [var.boot_command]
|
||||
|
||||
}
|
||||
|
||||
build {
|
||||
name = "template"
|
||||
sources = ["source.vsphere-iso.ubuntu-24-04-x64"]
|
||||
|
||||
provisioner "file" {
|
||||
destination = "/tmp/prep-script.sh"
|
||||
source = "${path.root}data/prep-script.sh"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"sudo chmod 755 /tmp/prep-script.sh",
|
||||
"sudo /tmp/prep-script.sh",
|
||||
]
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user