From cb410f3dc504b1d28bae4c392d4a812334e84f28 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Sat, 20 Apr 2024 22:05:11 -0400 Subject: [PATCH] Standardized hardware config on templates to use better CPU and disk types; Updated Ubuntu 22, Rocky 9 and Almalinux 9 post-install stuff --- Almalinux-9/almalinux-9.pkr.hcl | 2 ++ Debian-12/debian-12.pkr.hcl | 4 +++- FreeBSD-14/freebsd-14.pkr.hcl | 4 +++- Rocky-9/rocky-9.pkr.hcl | 6 +++--- Ubuntu-22/ubuntu-22.pkr.hcl | 20 ++++++------------ http/almalinux-9-server.ks | 8 +++----- http/rocky-9-server.ks | 8 +++----- http/ubuntu-22/meta-data | 0 http/ubuntu-22/user-data | 36 +++++++++++++++++---------------- 9 files changed, 42 insertions(+), 46 deletions(-) create mode 100644 http/ubuntu-22/meta-data diff --git a/Almalinux-9/almalinux-9.pkr.hcl b/Almalinux-9/almalinux-9.pkr.hcl index 81219dc..3e417ce 100644 --- a/Almalinux-9/almalinux-9.pkr.hcl +++ b/Almalinux-9/almalinux-9.pkr.hcl @@ -22,7 +22,9 @@ source "proxmox-iso" "almalinux-9" { os = "l26" cores = "2" sockets = "1" + cpu_type = "host" memory = "2048" + scsi_controller = "virtio-scsi-single" disks { disk_size = "30G" storage_pool = "templates" diff --git a/Debian-12/debian-12.pkr.hcl b/Debian-12/debian-12.pkr.hcl index 1e60651..f344f59 100644 --- a/Debian-12/debian-12.pkr.hcl +++ b/Debian-12/debian-12.pkr.hcl @@ -22,9 +22,11 @@ source "proxmox-iso" "debian-12" { os = "l26" cores = "2" sockets = "1" + cpu_type = "host" memory = "2048" + scsi_controller = "virtio-scsi-single" disks { - disk_size = "10G" + disk_size = "30G" storage_pool = "templates" type = "scsi" } diff --git a/FreeBSD-14/freebsd-14.pkr.hcl b/FreeBSD-14/freebsd-14.pkr.hcl index 7ad2d0d..634bc22 100644 --- a/FreeBSD-14/freebsd-14.pkr.hcl +++ b/FreeBSD-14/freebsd-14.pkr.hcl @@ -18,9 +18,11 @@ source "proxmox-iso" "freebsd-14" { os = "other" cores = "2" sockets = "1" + cpu_type = "host" memory = "2048" + scsi_controller = "virtio-scsi-single" disks { - disk_size = "10G" + disk_size = "30G" storage_pool = "templates" type = "scsi" } diff --git a/Rocky-9/rocky-9.pkr.hcl b/Rocky-9/rocky-9.pkr.hcl index 552d367..4130664 100644 --- a/Rocky-9/rocky-9.pkr.hcl +++ b/Rocky-9/rocky-9.pkr.hcl @@ -20,11 +20,11 @@ source "proxmox-iso" "rocky-9" { http_port_min = "8080" os = "l26" - machine = "pc" - scsi_controller = "virtio-scsi-single" cores = "2" sockets = "1" + cpu_type = "host" memory = "2048" + scsi_controller = "virtio-scsi-single" disks { disk_size = "30G" storage_pool = "templates" @@ -39,7 +39,7 @@ source "proxmox-iso" "rocky-9" { insecure_skip_tls_verify = true username = "${var.proxmox_apiuser}" password = "${var.proxmox_apitoken}" - node = "kamino" + node = "geonosis" iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-boot.iso" iso_checksum = "sha256:eb096f0518e310f722d5ebd4c69f0322df4fc152c6189f93c5c797dc25f3d2e1" diff --git a/Ubuntu-22/ubuntu-22.pkr.hcl b/Ubuntu-22/ubuntu-22.pkr.hcl index 9c02478..0915c4f 100644 --- a/Ubuntu-22/ubuntu-22.pkr.hcl +++ b/Ubuntu-22/ubuntu-22.pkr.hcl @@ -18,23 +18,15 @@ source "proxmox-iso" "ubuntu-22" { "e", # Go to the end of the boot command - "", - - # Remove the kernel command-line that already exists - "", - "", - "", - "", - "", - "", - "", + " ", # Add kernel command-line and start install "linux ", "/casper/vmlinuz ", + "--- ", "autoinstall ", - "ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-22/ ", - "" + "ds=\"nocloud-net;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-22/\"", + "x" ] http_directory = "http" @@ -42,11 +34,11 @@ source "proxmox-iso" "ubuntu-22" { http_port_min = "8080" os = "l26" - machine = "pc" - scsi_controller = "virtio-scsi-single" cores = "2" sockets = "1" + cpu_type = "host" memory = "2048" + scsi_controller = "virtio-scsi-single" disks { disk_size = "30G" storage_pool = "templates" diff --git a/http/almalinux-9-server.ks b/http/almalinux-9-server.ks index f78a3d7..1fc5416 100644 --- a/http/almalinux-9-server.ks +++ b/http/almalinux-9-server.ks @@ -14,7 +14,7 @@ rootpw --iscrypted $6$kkuIkd8S9gDUhK8g$1XbqJDCjt1zQAhxb9sC2mE5CGd.D0xV1efu0R8h1e authselect --useshadow --passalgo=sha512 # Create my initial user :D #user --disabled -user --name=xadmin --shell=/bin/bash --homedir=/home/xadmin --iscrypted --password=$6$y6lN/cfPPtlyaTXu$4QUYFl816sxWPuyR.eY6mCJ3ybYLNcF6Pw4ar4K7Dyy9LbedK3PjkTNZfWqSdoPRpJMjtrbpY1xQ.zDXxOTug. +user --name=xadmin --shell=/bin/bash --homedir=/home/xadmin --iscrypted --password=$6$8DdxHyrH6HfGZhDs$jEadYAMi3CTJivYgGjhG7S2C/ChZxv0w0L6AQ3Egn8K5xIA4OEqDngVfozfn.9kYxy.hWYpzwBE0qwytcU4BF0 network --device=eth0 --bootproto=dhcp --ipv6=auto --activate @@ -42,7 +42,6 @@ reboot --eject @core nfs-utils sudo -qemu-guest-agent %end @@ -50,13 +49,12 @@ qemu-guest-agent # Update the system yum -y update # Istall the EPEL repository -yum -y install epel-release +dnf -y install epel-release -yum -y install wget vim yum-plugin-versionlock +dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent usermod -aG wheel xadmin systemctl enable qemu-guest-agent %end - diff --git a/http/rocky-9-server.ks b/http/rocky-9-server.ks index f78a3d7..1fc5416 100644 --- a/http/rocky-9-server.ks +++ b/http/rocky-9-server.ks @@ -14,7 +14,7 @@ rootpw --iscrypted $6$kkuIkd8S9gDUhK8g$1XbqJDCjt1zQAhxb9sC2mE5CGd.D0xV1efu0R8h1e authselect --useshadow --passalgo=sha512 # Create my initial user :D #user --disabled -user --name=xadmin --shell=/bin/bash --homedir=/home/xadmin --iscrypted --password=$6$y6lN/cfPPtlyaTXu$4QUYFl816sxWPuyR.eY6mCJ3ybYLNcF6Pw4ar4K7Dyy9LbedK3PjkTNZfWqSdoPRpJMjtrbpY1xQ.zDXxOTug. +user --name=xadmin --shell=/bin/bash --homedir=/home/xadmin --iscrypted --password=$6$8DdxHyrH6HfGZhDs$jEadYAMi3CTJivYgGjhG7S2C/ChZxv0w0L6AQ3Egn8K5xIA4OEqDngVfozfn.9kYxy.hWYpzwBE0qwytcU4BF0 network --device=eth0 --bootproto=dhcp --ipv6=auto --activate @@ -42,7 +42,6 @@ reboot --eject @core nfs-utils sudo -qemu-guest-agent %end @@ -50,13 +49,12 @@ qemu-guest-agent # Update the system yum -y update # Istall the EPEL repository -yum -y install epel-release +dnf -y install epel-release -yum -y install wget vim yum-plugin-versionlock +dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent usermod -aG wheel xadmin systemctl enable qemu-guest-agent %end - diff --git a/http/ubuntu-22/meta-data b/http/ubuntu-22/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/http/ubuntu-22/user-data b/http/ubuntu-22/user-data index 0a25f86..7d7ef9d 100644 --- a/http/ubuntu-22/user-data +++ b/http/ubuntu-22/user-data @@ -1,24 +1,21 @@ #cloud-config autoinstall: version: 1 + early-commands: - systemctl stop ssh + locale: en_US.UTF-8 keyboard: layout: us - network: - network: - version: 2 - ethernets: - eth0: - dhcp4: yes - dhcp-identifier: mac + apt: + geoip: true preserve_sources_list: false primary: - - arches: [i386, amd64] - uri: "http://archive.ubuntu.com/ubuntu" - geoip: true + - arches: [i386, amd64] + uri: "http://archive.ubuntu.com/ubuntu" + storage: layout: name: lvm @@ -28,15 +25,20 @@ autoinstall: 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" + user-data: + disable_root: true + package_upgrade: true ssh: allow-pw: true authorized-keys: [] install-server: true + + late-commands: + - "echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/xadmin" + - "chmod 440 /target/etc/sudoers.d/xadmin" + + bootcmd: + - "apt install -y qemu-guest-agent" + - "systemctl enable qemu-guest-agent" + - "systemctl start qemu-guest-agent"