87 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			HCL
		
	
	
	
	
	
			
		
		
	
	
			87 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			HCL
		
	
	
	
	
	
| variable "proxmox_apiuser" {
 | |
|   type    = string
 | |
|   default = "packer"
 | |
| }
 | |
| 
 | |
| variable "proxmox_apitoken" {
 | |
|   type    = string
 | |
|   default = "changeme"
 | |
| }
 | |
| 
 | |
| source "proxmox-iso" "ubuntu-22" {
 | |
|   template_name            = "ubuntu-22"
 | |
|   template_description     = "Ubuntu 22.04, generated on ${timestamp()}"
 | |
|   vm_id                    = "205"
 | |
|   boot_wait                = "10s"
 | |
|   boot_key_interval        = "200ms"
 | |
|   boot_command             = [
 | |
|     # Edit boot options
 | |
|     "e<wait>",
 | |
| 
 | |
|     # Go to the end of the boot command
 | |
|     "<down><down><down><down><left> <wait>",
 | |
| 
 | |
|     # Add kernel command-line to start autoinstall
 | |
|     "autoinstall ",
 | |
|     "ds=\"nocloud-net;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/\"",
 | |
|     "<leftCtrlOn>x<leftCtrlOff><wait>"
 | |
|   ]
 | |
| 
 | |
|   http_directory           = "http"
 | |
|   http_port_max            = "8089"
 | |
|   http_port_min            = "8080"
 | |
| 
 | |
|   os                       = "l26"
 | |
|   cores                    = "2"
 | |
|   sockets                  = "1"
 | |
|   cpu_type                 = "host"
 | |
|   memory                   = "2048"
 | |
|   scsi_controller          = "virtio-scsi-single"
 | |
|   disks {
 | |
|     disk_size              = "30G"
 | |
|     storage_pool           = "templates"
 | |
|     type                   = "scsi"
 | |
|     format                 = "qcow2"
 | |
|   }
 | |
|   network_adapters {
 | |
|     bridge                 = "vmbr0"
 | |
|     model                  = "virtio"
 | |
|   }
 | |
| 
 | |
|   proxmox_url              = "https://kamino.int.metaunix.net:8006/api2/json/"
 | |
|   insecure_skip_tls_verify = true
 | |
|   username                 = "${var.proxmox_apiuser}"
 | |
|   password                 = "${var.proxmox_apitoken}"
 | |
|   node                     = "kamino"
 | |
|   pool                     = "Templates"
 | |
| 
 | |
|   boot_iso {
 | |
|     type                   = "scsi"
 | |
|     iso_url                = "https://releases.ubuntu.com/22.04.5/ubuntu-22.04.5-live-server-amd64.iso"
 | |
|     iso_checksum           = "sha256:9bc6028870aef3f74f4e16b900008179e78b130e6b0b9a140635434a46aa98b0"
 | |
|     iso_download_pve       = true
 | |
|     iso_storage_pool       = "iso"
 | |
|     unmount                = true
 | |
|   }
 | |
| 
 | |
|   ssh_username             = "xadmin"
 | |
|   ssh_password             = "packer"
 | |
|   ssh_timeout              = "20m"
 | |
| }
 | |
| 
 | |
| build {
 | |
|   sources = ["source.proxmox-iso.ubuntu-22"]
 | |
| 
 | |
|   provisioner "shell" {
 | |
|     scripts = [
 | |
|       "scripts/debian-install.sh",
 | |
|       "scripts/remove-snap.sh"
 | |
|     ]
 | |
|   }
 | |
| 
 | |
|   provisioner "file" {
 | |
|     source      = "scripts/initial-setup.sh"
 | |
|     destination = "/home/xadmin/initial-setup.sh"
 | |
|   }
 | |
| }
 |