marcinbojko / proxmox-kvm-packer

Proxmox and KVM Templates - Virtual Machines using packer
Apache License 2.0
46 stars 9 forks source link
almalinux kvm linux oraclelinux packer proxmox rockylinux ubuntu

Proxmox and KVM related Virtual Machines using Hashicorp's Packer

RockyLinux OracleLinux AlmaLinux UbuntuLinux OpenSuse Windows2019 Windows2022

"Buy Me A Coffee"

Consider buying me a coffee if you like my work. All donations are appreciated. All donations will be used to pay for pipeline running costs

Proxmox

Proxmox requirements

Usage

Command OS FullName and Version Boot Type
./proxmox_generic.sh -V almalinux88 -F rhel -U true AlmaLinux 8.8 UEFI
./proxmox_generic.sh -V almalinux88 -F rhel -U false AlmaLinux 8.8 BIOS
./proxmox_generic.sh -V almalinux89 -F rhel -U true AlmaLinux 8.9 UEFI
./proxmox_generic.sh -V almalinux89 -F rhel -U false AlmaLinux 8.9 BIOS
./proxmox_generic.sh -V almalinux810 -F rhel -U true AlmaLinux 8.10 UEFI
./proxmox_generic.sh -V almalinux810 -F rhel -U false AlmaLinux 8.10 BIOS
./proxmox_generic.sh -V almalinux92 -F rhel -U true AlmaLinux 9.2 UEFI
./proxmox_generic.sh -V almalinux92 -F rhel -U false AlmaLinux 9.2 BIOS
./proxmox_generic.sh -V almalinux93 -F rhel -U true AlmaLinux 9.3 UEFI
./proxmox_generic.sh -V almalinux93 -F rhel -U false AlmaLinux 9.3 BIOS
./proxmox_generic.sh -V almalinux94 -F rhel -U true AlmaLinux 9.4 UEFI
./proxmox_generic.sh -V almalinux94 -F rhel -U false AlmaLinux 9.4 BIOS
./proxmox_generic.sh -V opensuse_leap_15_5 -F sles -U true openSUSE Leap 15.5 UEFI
./proxmox_generic.sh -V opensuse_leap_15_5 -F sles -U false openSUSE Leap 15.5 BIOS
./proxmox_generic.sh -V opensuse_leap_15_6 -F sles -U true openSUSE Leap 15.6 UEFI
./proxmox_generic.sh -V opensuse_leap_15_6 -F sles -U false openSUSE Leap 15.6 BIOS
./proxmox_generic.sh -V oraclelinux810 -F rhel -U true Oracle Linux 8.10 UEFI
./proxmox_generic.sh -V oraclelinux810 -F rhel -U false Oracle Linux 8.10 BIOS
./proxmox_generic.sh -V oraclelinux88 -F rhel -U true Oracle Linux 8.8 UEFI
./proxmox_generic.sh -V oraclelinux88 -F rhel -U false Oracle Linux 8.8 BIOS
./proxmox_generic.sh -V oraclelinux89 -F rhel -U true Oracle Linux 8.9 UEFI
./proxmox_generic.sh -V oraclelinux89 -F rhel -U false Oracle Linux 8.9 BIOS
./proxmox_generic.sh -V oraclelinux92 -F rhel -U true Oracle Linux 9.2 UEFI
./proxmox_generic.sh -V oraclelinux92 -F rhel -U false Oracle Linux 9.2 BIOS
./proxmox_generic.sh -V oraclelinux93 -F rhel -U true Oracle Linux 9.3 UEFI
./proxmox_generic.sh -V oraclelinux93 -F rhel -U false Oracle Linux 9.3 BIOS
./proxmox_generic.sh -V oraclelinux94 -F rhel -U true Oracle Linux 9.4 UEFI
./proxmox_generic.sh -V oraclelinux94 -F rhel -U false Oracle Linux 9.4 BIOS
./proxmox_generic.sh -V rockylinux810 -F rhel -U true Rocky Linux 8.10 UEFI
./proxmox_generic.sh -V rockylinux810 -F rhel -U false Rocky Linux 8.10 BIOS
./proxmox_generic.sh -V rockylinux88 -F rhel -U true Rocky Linux 8.8 UEFI
./proxmox_generic.sh -V rockylinux88 -F rhel -U false Rocky Linux 8.8 BIOS
./proxmox_generic.sh -V rockylinux89 -F rhel -U true Rocky Linux 8.9 UEFI
./proxmox_generic.sh -V rockylinux89 -F rhel -U false Rocky Linux 8.9 BIOS
./proxmox_generic.sh -V rockylinux92 -F rhel -U true Rocky Linux 9.2 UEFI
./proxmox_generic.sh -V rockylinux92 -F rhel -U false Rocky Linux 9.2 BIOS
./proxmox_generic.sh -V rockylinux93 -F rhel -U true Rocky Linux 9.3 UEFI
./proxmox_generic.sh -V rockylinux93 -F rhel -U false Rocky Linux 9.3 BIOS
./proxmox_generic.sh -V rockylinux94 -F rhel -U true Rocky Linux 9.4 UEFI
./proxmox_generic.sh -V rockylinux94 -F rhel -U false Rocky Linux 9.4 BIOS
./proxmox_generic.sh -V ubuntu2204 -F ubuntu -U true Ubuntu 22.04 UEFI
./proxmox_generic.sh -V ubuntu2204 -F ubuntu -U false Ubuntu 22.04 BIOS
./proxmox_generic.sh -V ubuntu2304 -F ubuntu -U true Ubuntu 23.04 UEFI
./proxmox_generic.sh -V ubuntu2304 -F ubuntu -U false Ubuntu 23.04 BIOS
./proxmox_generic.sh -V ubuntu2404 -F ubuntu -U true Ubuntu 24.04 UEFI
./proxmox_generic.sh -V ubuntu2404 -F ubuntu -U false Ubuntu 24.04 BIOS
./proxmox_generic.sh -V windows2019-dc -F windows -U true Windows Server 2019 Datacenter UEFI
./proxmox_generic.sh -V windows2019-dc -F windows -U false Windows Server 2019 Datacenter BIOS
./proxmox_generic.sh -V windows2019-std -F windows -U true Windows Server 2019 Standard UEFI
./proxmox_generic.sh -V windows2019-std -F windows -U false Windows Server 2019 Standard BIOS
./proxmox_generic.sh -V windows2022-dc -F windows -U true Windows Server 2022 Datacenter UEFI
./proxmox_generic.sh -V windows2022-dc -F windows -U false Windows Server 2022 Datacenter BIOS
./proxmox_generic.sh -V windows2022-std -F windows -U true Windows Server 2022 Standard UEFI
./proxmox_generic.sh -V windows2022-std -F windows -U false Windows Server 2022 Standard BIOS
OS script Comments
Alma Linux 8.8 ./proxmox_almalinux_88.sh
Alma Linux 8.9 ./proxmox_almalinux_89.sh
Alma Linux 8.10 ./proxmox_almalinux_810.sh
Alma Linux 9.2 ./proxmox_almalinux_92.sh
Alma Linux 9.3 ./proxmox_almalinux_93.sh
Alma Linux 9.4 ./proxmox_almalinux_94.sh
OpenSuse Leap 15.5 ./proxmox_opensuse_leap_15_5.sh
Oracle Linux 8.8 ./proxmox_oraclelinux_88.sh
Oracle Linux 8.9 ./proxmox_oraclelinux_89.sh
Oracle Linux 8.10 ./proxmox_oraclelinux_810.sh
Oracle Linux 9.2 ./proxmox_oraclelinux_92.sh
Oracle Linux 9.3 ./proxmox_oraclelinux_93.sh
Oracle Linux 9.4 ./proxmox_oraclelinux_94.sh
Rocky Linux 8.8 ./proxmox_rockylinux_88.sh
Rocky Linux 8.9 ./proxmox_rockylinux_89.sh
Rocky Linux 9.2 ./proxmox_rockylinux_92.sh
Rocky Linux 9.3 ./proxmox_rockylinux_93.sh
Rocky Linux 9.4 ./proxmox_rockylinux_94.sh
Ubuntu 22.04 HWE LTS ./proxmox_ubuntu_2204_hwe.sh HWE Kernel
Ubuntu 22.04 LTS ./proxmox_ubuntu_2204.sh
Ubuntu 23.04 ./proxmox_ubuntu_2304.sh
Ubuntu 24.04 ./proxmox_ubuntu_2404.sh
Microsoft Windows 2022 Datacenter ./proxmox_windows_2022-dc.sh Datacenter Edition
Microsoft Windows 2022 Standard ./proxmox_windows_2022-std.sh Standard Edition
Microsoft Windows 2019 Standard ./proxmox_windows_2019-std.sh Standard Edition
Microsoft Windows 2019 Datacenter ./proxmox_windows_2019-dc.sh Datacenter Edition

Provisioning

example:

  install_epel:                  true
  install_webmin:                false
  install_hyperv:                false
  install_cockpit:               true
  install_neofetch:              true
  install_updates:               true
  install_extra_groups:          true
  docker_prepare:                false
  extra_device:                  ""
  install_motd:                  true

Updates

In case of RHEL clones, only current release is allowed to do updates, as updating for example Alma Linux 8.8 will always end in current release (8.10). This is due to the way how RHEL clones are built. To avoid that, all updates in NON current releases are disabled by setting extra variable for ansible playbook install_updates: false

ansible_extra_args        = ["-e", "@extra/playbooks/provision_rocky8_variables.yml", "-e", "@variables/rockylinux8.yml", "-e", "{\"install_updates\": false}","--scp-extra-args", "'-O'"]

if you really want to start from historical release and update it to current release, remove "-e","{\"install_updates\": false}" from ansible_extra_args variable

KVM

KVM Requirements

Cloud-init support

KVM builds are separated by cloud-init groups. Currently supported groups are:

RHEL

Ubuntu

KVM scripts usage

Parameters

KVM building scripts will take 2 runtime parameters:

Example:

./kvm_rockylinux92.sh 1 generic #This will build Rocky Linux 9.2 with generic cloud-init configuration and PACKER_LOG set to verbose output

Example 2

./kvm_rockylinux92.sh oci #This will build Rocky Linux 9.2 with oci cloud-init configuration and PACKER_LOG set to 0 (default)

KVM building scripts, by OS with cloud parameters

OS script Comments Generic OCI AliCloud
Alma Linux 8.7 ./kvm_almalinux87.sh generic/empty oci alicloud
Alma Linux 8.8 ./kvm_almalinux88.sh generic/empty oci alicloud
Alma Linux 8.9 ./kvm_almalinux89.sh generic/empty oci alicloud
Alma Linux 8.10 ./kvm_almalinux810.sh generic/empty oci alicloud
Alma Linux 9.0 ./kvm_almalinux90.sh generic/empty oci alicloud
Alma Linux 9.1 ./kvm_almalinux91.sh generic/empty oci alicloud
Alma Linux 9.2 ./kvm_almalinux92.sh generic/empty oci alicloud
Alma Linux 9.3 ./kvm_almalinux93.sh generic/empty oci alicloud
Alma Linux 9.4 ./kvm_almalinux94.sh generic/empty oci alicloud
Oracle Linux 8.6 ./kvm_oraclelinux86.sh generic/empty oci alicloud
Oracle Linux 8.7 ./kvm_oraclelinux87.sh generic/empty oci alicloud
Oracle Linux 8.8 ./kvm_oraclelinux88.sh generic/empty oci alicloud
Oracle Linux 8.9 ./kvm_oraclelinux89.sh generic/empty oci alicloud
Oracle Linux 8.10 ./kvm_oraclelinux810.sh generic/empty oci alicloud
Oracle Linux 9.0 ./kvm_oraclelinux90.sh generic/empty oci alicloud
Oracle Linux 9.1 ./kvm_oraclelinux91.sh generic/empty oci alicloud
Oracle Linux 9.2 ./kvm_oraclelinux92.sh generic/empty oci alicloud
Oracle Linux 9.3 ./kvm_oraclelinux93.sh generic/empty oci alicloud
Oracle Linux 9.4 ./kvm_oraclelinux94.sh generic/empty oci alicloud
Rocky Linux 8.7 ./kvm_rockylinux87.sh generic/empty oci alicloud
Rocky Linux 8.8 ./kvm_rockylinux88.sh generic/empty oci alicloud
Rocky Linux 8.9 ./kvm_rockylinux89.sh generic/empty oci alicloud
Rocky Linux 9.0 ./kvm_rockylinux90.sh generic/empty oci alicloud
Rocky Linux 9.1 ./kvm_rockylinux91.sh generic/empty oci alicloud
Rocky Linux 9.2 ./kvm_rockylinux92.sh generic/empty oci alicloud
Rocky Linux 9.3 ./kvm_rockylinux93.sh generic/empty oci alicloud
Rocky Linux 9.4 ./kvm_rockylinux94.sh generic/empty oci alicloud

Default credentials

OS username password
Windows Administrator password
Alma/Rocky/Oracle root password
OpenSuse root password
Ubuntu ubuntu password

Known Issues

Windows UEFI boot and 'Press any key to boot from CD or DVD' issue

When using the proxmox builder with efi firmware, the Windows installer will not boot automatically. Instead, it will display the message Press any key to boot from CD or DVD and wait for user input. User needs to properly adjust boot_wait and boot_command wait times to find the right balance between waiting for the installer to boot and waiting for the user to press a key.

OpenSuse Leap stage 2 sshd fix

When building OpenSuse Leap 15.x sshd service starts in stage 2 which breaks packer scripts. There is an artificial delay added to builder (6 minutes) to wait for sshd to start. This is not ideal solution, but it works.

To DO

Q & A

Q: Will you add support for other OSes? A: Yes, I will add support for other OSes as I need them. If you need support for a specific OS, please open an issue and I will try to add it.

Q: Will you add support for other hypervisors? A: No, this repository is dedicated to Proxmox and KVM. If you need support for other hypervisors, please look at my other repositories

Q: Will you add support for other cloud providers? A: Since some of cloud providers are using KVM based hypervisors, building custom image with KVM and importing them will solve the case

Q: Will you add support RHEL and RedHat based OSes? A: No, I will not add support for RHEL and RedHat directly, due to their licensing. However, I will add support for RHEL based OSes like AlmaLinux, Oracle Linux and Rocky Linux.

Q: Can I help? A: Yes, please open an issue or a pull request and I will try to help you. Please split PRs into separate commits for block of changes.

Q: Can I use this repository for my own projects? A: Yes, this repository is licensed under the Apache 2 license, so you can use it for your own projects. Please note that some of the files are licensed under different licenses, so please check the licenses of the individual files before using them