diff --git a/Ubuntu-22/ubuntu-22.pkr.hcl b/Ubuntu-22/ubuntu-22.pkr.hcl new file mode 100644 index 0000000..784d1a0 --- /dev/null +++ b/Ubuntu-22/ubuntu-22.pkr.hcl @@ -0,0 +1,77 @@ +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 = "Rocky Linux 9.3, generated on ${timestamp()}" + boot_wait = "10s" + boot_key_interval = "200ms" + boot_command = [ + # Make the language selector appear... + " ", + # ...then get rid of it + " ", + + # Go to the other installation options menu and leave it + "", + + # Remove the kernel command-line that already exists + "", + "", + "", + + # Add kernel command-line and start install + "/casper/vmlinuz ", + "initrd=/casper/initrd ", + "autoinstall ", + "ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-22/ ", + "" + ] + + http_directory = "http" + http_port_max = "8089" + http_port_min = "8080" + + os = "l26" + machine = "pc" + scsi_controller = "virtio-scsi-single" + cores = "2" + sockets = "1" + memory = "2048" + disks { + disk_size = "30G" + storage_pool = "templates" + type = "scsi" + } + 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" + + iso_url = "https://releases.ubuntu.com/22.04.4/ubuntu-22.04.4-live-server-amd64.iso" + iso_checksum = "sha256:45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2 " + iso_storage_pool = "iso" + unmount_iso = true + iso_download_pve = true + + ssh_username = "xadmin" + ssh_password = "packer" + ssh_timeout = "20m" +} + +build { + sources = ["source.proxmox-iso.ubuntu-22"] +} diff --git a/http/ubuntu-22/user-data b/http/ubuntu-22/user-data new file mode 100644 index 0000000..b93645a --- /dev/null +++ b/http/ubuntu-22/user-data @@ -0,0 +1,35 @@ +#cloud-config +autoinstall: + version: 1 + early-commands: + - systemctl stop ssh + locale: en_US.UTF-8 + keyboard: + layout: us + apt: + preserve_sources_list: false + primary: + - arches: [i386, amd64] + uri: "http://archive.ubuntu.com/ubuntu" + geoip: true + storage: + layout: + name: lvm + + identity: + hostname: ubuntu + username: xadmin + password: $6$8DdxHyrH6HfGZhDs$jEadYAMi3CTJivYgGjhG7S2C/ChZxv0w0L6AQ3Egn8K5xIA4OEqDngVfozfn.9kYxy.hWYpzwBE0qwytcU4BF0 + + + late-commands: + - "echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/xadmin" + - "chmod 440 /target/etc/sudoers.d/ubuntu" + - "apt install -y qemu-guest-agent" + - "systemctl enable qemu-guest-agent" + - "apt purge -y snapd" + + ssh: + allow-pw: true + authorized-keys: [] + install-server: true