Merge pull request #10 from ajschroeder/develop

feat: add almalinux and rocky linux version 10
This commit is contained in:
TheHitman1977
2025-06-18 23:52:05 -05:00
committed by GitHub
19 changed files with 1829 additions and 45 deletions

View File

@@ -25,8 +25,9 @@ The following builds are available:
| Operating System | Version | Custom Storage Config | Static IP Support | UEFI Bootloader | BIOS Bootloader | | Operating System | Version | Custom Storage Config | Static IP Support | UEFI Bootloader | BIOS Bootloader |
| :--- | :--- | :---: | :---: | :---: | :---: | | :--- | :--- | :---: | :---: | :---: | :---: |
| AlmaLinux | 9 | ✓ | ✓ | ✓ | | | AlmaLinux | 10 | ✓ | ✓ | ✓ | ✓ |
| AlmaLinux | 8 | ✓ | ✓ | ✓ | | | AlmaLinux | 9 | ✓ | ✓ | ✓ | ✓ |
| AlmaLinux | 8 | ✓ | ✓ | ✓ | ✓ |
| CentOS Stream | 10 | ✓ | ✓ | ✓ | ✓ | | CentOS Stream | 10 | ✓ | ✓ | ✓ | ✓ |
| CentOS Stream | 9 | ✓ | ✓ | ✓ | ✓ | | CentOS Stream | 9 | ✓ | ✓ | ✓ | ✓ |
| Debian | 12 | ✓ | ✓ | ✓ | ✓ | | Debian | 12 | ✓ | ✓ | ✓ | ✓ |
@@ -35,6 +36,7 @@ The following builds are available:
| OpenSUSE Leap | 15.5 | ✓ | ✓ | ✓ | ✓ | | OpenSUSE Leap | 15.5 | ✓ | ✓ | ✓ | ✓ |
| Oracle Linux | 9 | ✓ | ✓ | ✓ | ✓ | | Oracle Linux | 9 | ✓ | ✓ | ✓ | ✓ |
| Oracle Linux | 8 | ✓ | ✓ | ✓ | ✓ | | Oracle Linux | 8 | ✓ | ✓ | ✓ | ✓ |
| Rocky Linux | 10 | ✓ | ✓ | ✓ | ✓ |
| Rocky Linux | 9 | ✓ | ✓ | ✓ | ✓ | | Rocky Linux | 9 | ✓ | ✓ | ✓ | ✓ |
| Rocky Linux | 8 | ✓ | ✓ | ✓ | ✓ | | Rocky Linux | 8 | ✓ | ✓ | ✓ | ✓ |
| Ubuntu Server | 24.04 LTS | ✓ | ✓ | ✓ | ✓ | | Ubuntu Server | 24.04 LTS | ✓ | ✓ | ✓ | ✓ |
@@ -723,7 +725,7 @@ vm_disk_lvm = [
## Packer Machine Image Builds ## Packer Machine Image Builds
Edit the `*.auto.pkrvars.hcl` file in each `builds/<type>/<build>` directory to configure the following virtual machine hardware settings, as required: Edit the `<build type>.pkrvars.hcl` file in the `config` directory for each type of build to set the following virtual machine hardware settings, as required:
- CPUs `(int)` - CPUs `(int)`
- CPU Cores `(int)` - CPU Cores `(int)`
@@ -732,7 +734,7 @@ Edit the `*.auto.pkrvars.hcl` file in each `builds/<type>/<build>` directory to
- .iso Path `(string)` - .iso Path `(string)`
- .iso File `(string)` - .iso File `(string)`
```hcl title="builds/linux/debian/11/linux-debian.auto.pkrvars.hcl" ```hcl title="config/linux-ubuntu-22-04-lts.pkrvars.hcl"
// Guest Operating System Metadata // Guest Operating System Metadata
vm_os_language = "en_US" vm_os_language = "en_US"
vm_os_keyboard = "us" vm_os_keyboard = "us"
@@ -773,24 +775,42 @@ vm_firmware_path = "./OVMF.fd"
> **Note** > **Note**
> >
> All `variables.auto.pkrvars.hcl` default to using: > All `config/<build type>.pkrvars.hcl` default to using:
> - VirtIO SCSI storage device > - VirtIO SCSI storage device
> - VirtIO (paravirtualized) network card device > - VirtIO (paravirtualized) network card device
> - BIOS boot firmware > - UEFI boot firmware
The defaults use VirtIO to balance out performance, compatibility, and ease of use. Feel free to change the storage and network controllers to suit your needs. However, if you change the storage or network controllers and run into issues you should change them back to defaults and try the builds again. I won't support any builds that don't use the VirtIO drivers. The defaults use VirtIO to balance out performance, compatibility, and ease of use. Feel free to change the storage and network controllers to suit your needs. However, if you change the storage or network controllers and run into issues you should change them back to defaults and try the builds again. I won't support any builds that don't use the VirtIO drivers.
Both UEFI and BIOS booting are supported for builds. Inside the `*.auto.pkrvars.hcl` file specific to the build, you can set the `vm_bios` variable to either `seabios` for BIOS or `ovmf` for UEFI booting. The storage layouts are different for each bootloader type so you'll need to configure the storage layouts accordingly. Both UEFI and BIOS booting are supported for builds. Inside the `<build type>.pkrvars.hcl` file specific to the build, you can set the `vm_bios` variable to either `seabios` for BIOS or `ovmf` for UEFI booting.
If you are interested in more detail - when I first started testing these packer builds in my home lab I was using `ovmf` (UEFI) firmware. During my initial testing the ZFS pool where I housed my VMs cratered and I had to rebuild the pool and restore all my VMs from backups. During the recovery of my storage pool, I changed over to LVM and had to migrate VMs between storage pools several times and each VM that had EFI disks had to be shutdown, migrated, and then powered on. Offline migration isn't *that* much of an inconvenience, however at the time I was trying to figure out my VM storage and recover all my VMs it was just one more annoyance. All that said, I think Proxmox should support live migration regardless of VM firmware type. Maybe this will be addressed in a future release of Proxmox? > **Note**
>
> The storage layouts are different for each bootloader type so you'll need to configure the storage layouts accordingly.
### Cloud-Init ### Cloud-Init
All builds for operating systems that support [cloud-init][cloud-init] now have the option to enable it. This can be done on a per-build basis inside the `*.auto.pkrvars.hcl` files in the `builds/linux/<distro>/<version>/` directory. The default setting is `true`. All builds for operating systems that support [cloud-init][cloud-init] now have the option to enable it. This can be done on a per-build basis inside the `<build type>.pkrvars.hcl` files in the `config` directory. The default setting is `true`.
If a particular linux distribution ships with cloud-init (e.g. Ubuntu) and cloud-init is set to `false` in the `*.auto.pkrvars.hcl` packer file for the build, then cloud-init will be disabled in the operating system **and** within Proxmox for that specific template. If a particular linux distribution ships with cloud-init (e.g. Ubuntu) and cloud-init is set to `false` in the `config/<build type>.pkrvars.hcl` file for the build, then cloud-init will be disabled in the operating system **and** within Proxmox for that specific template.
# Known Issues # Known Issues
## Windows Builds
For obvious reasons, product keys and actual ISO names are not provided for any of the Windows builds in this repository. For example, if you wanted to build a Windows 11 template VM, the Windows 11 build uses the Windows 11 Enterprise Eval ISO. By default packer will build the Windows 11 Enterprise Eval whether you choose the Pro or Enterprise build when running `build.sh`. Also, this build by default should not require any interventions by a human.
If you have a valid product key and want to build a Windows 11 Pro or Enterprise template VM, you will need to change the following variables (if building Pro you don't need to change Enterprise vars and vice versa):
```hcl title="config/windows-desktop-11.pkrvars.hcl"
vm_inst_os_image_pro = "Windows 11 Enterprise Evaluation" <-- If building Professional with a valid key, you will need to enter in whatever the name of the Operating System is when the Windows install prompts you
vm_inst_os_key_pro = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
vm_inst_os_image_ent = "Windows 11 Enterprise Evaluation" <-- If building Enterprise with a valid key, you can remove the Evaluation from this string
vm_inst_os_key_ent = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
...
iso_file = "Name-of-Windows-11-Non-Evaluation-DVD.iso" <-- This is the name of the real Windows 11 DVD
```
If your template build hangs or times out, re-run it and then open the console of the template VM and see if Windows is waiting for you to select an Operating System. Select the Operating System version and then click Next and the build should work hands-off the rest of the way. If you want this to be completely hands-off, just change the `vm_inst_os_image_pro` and/or `vm_inst_os_image_ent` vars to match the Operating System selection entry exactly. Then the next time you execute the particular Windows template build, it shouldn't get stuck waiting for input.
# Unsupported Features # Unsupported Features
# Contributing # Contributing

148
build.sh
View File

@@ -49,6 +49,43 @@ if [ "$debug_mode" = true ]; then
fi fi
menu_option_1() { menu_option_1() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/10/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a AlmaLinux 10 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a AlmaLinux 10 Template for Proxmox. ###
echo "Building a AlmaLinux 10 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_2() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/9/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -85,7 +122,7 @@ menu_option_1() {
echo "Done." echo "Done."
} }
menu_option_2() { menu_option_3() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/8/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -122,7 +159,7 @@ menu_option_2() {
echo "Done." echo "Done."
} }
menu_option_3() { menu_option_4() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/10-stream/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/10-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -159,7 +196,7 @@ menu_option_3() {
echo "Done." echo "Done."
} }
menu_option_4() { menu_option_5() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/9-stream/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/9-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -196,7 +233,7 @@ menu_option_4() {
echo "Done." echo "Done."
} }
menu_option_5() { menu_option_6() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/12/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/12/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -233,7 +270,7 @@ menu_option_5() {
echo "Done." echo "Done."
} }
menu_option_6() { menu_option_7() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -270,7 +307,7 @@ menu_option_6() {
echo "Done." echo "Done."
} }
menu_option_7() { menu_option_8() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-6/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-6/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -307,7 +344,7 @@ menu_option_7() {
echo "Done." echo "Done."
} }
menu_option_8() { menu_option_9() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-5/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-5/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -344,7 +381,7 @@ menu_option_8() {
echo "Done." echo "Done."
} }
menu_option_9() { menu_option_10() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/9/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -381,7 +418,7 @@ menu_option_9() {
echo "Done." echo "Done."
} }
menu_option_10() { menu_option_11() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/8/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -418,7 +455,44 @@ menu_option_10() {
echo "Done." echo "Done."
} }
menu_option_11() { menu_option_12() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/10/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 10 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Rocky Linux 10 for Proxmox. ###
echo "Building a Rocky Linux 10 for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_13() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/9/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -455,7 +529,7 @@ menu_option_11() {
echo "Done." echo "Done."
} }
menu_option_12() { menu_option_14() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/8/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -492,7 +566,7 @@ menu_option_12() {
echo "Done." echo "Done."
} }
menu_option_13() { menu_option_15() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/24-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/24-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -529,7 +603,7 @@ menu_option_13() {
echo "Done." echo "Done."
} }
menu_option_14() { menu_option_16() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -566,7 +640,7 @@ menu_option_14() {
echo "Done." echo "Done."
} }
menu_option_15() { menu_option_17() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -603,7 +677,7 @@ menu_option_15() {
echo "Done." echo "Done."
} }
menu_option_16() { menu_option_18() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/ INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -639,7 +713,7 @@ menu_option_16() {
echo "Done." echo "Done."
} }
menu_option_17() { menu_option_19() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/ INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -676,7 +750,7 @@ menu_option_17() {
echo "Done." echo "Done."
} }
menu_option_18() { menu_option_20() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/ INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
@@ -745,24 +819,26 @@ until [ "$selection" = "0" ]; do
echo "" echo ""
echo " Linux Distribution:" echo " Linux Distribution:"
echo "" echo ""
echo " 1 - AlmaLinux 9" echo " 1 - AlmaLinux 10"
echo " 2 - AlmaLinux 8" echo " 2 - AlmaLinux 9"
echo " 3 - CentOS 10 Stream" echo " 3 - AlmaLinux 8"
echo " 4 - CentOS 9 Stream" echo " 4 - CentOS 10 Stream"
echo " 5 - Debian 12" echo " 5 - CentOS 9 Stream"
echo " 6 - Debian 11" echo " 6 - Debian 12"
echo " 7 - OpenSUSE Leap 15.6" echo " 7 - Debian 11"
echo " 8 - OpenSUSE Leap 15.5" echo " 8 - OpenSUSE Leap 15.6"
echo " 9 - Oracle Linux 9" echo " 9 - OpenSUSE Leap 15.5"
echo " 10 - Oracle Linux 8" echo " 10 - Oracle Linux 9"
echo " 11 - Rocky Linux 9" echo " 11 - Oracle Linux 8"
echo " 12 - Rocky Linux 8" echo " 12 - Rocky Linux 10"
echo " 13 - Ubuntu Server 24.04 LTS" echo " 13 - Rocky Linux 9"
echo " 14 - Ubuntu Server 22.04 LTS" echo " 14 - Rocky Linux 8"
echo " 15 - Ubuntu Server 20.04 LTS" echo " 15 - Ubuntu Server 24.04 LTS"
echo " 16 - Windows 11 - All" echo " 16 - Ubuntu Server 22.04 LTS"
echo " 17 - Windows 11 - Enterprise Only" echo " 17 - Ubuntu Server 20.04 LTS"
echo " 18 - Windows 11 - Professional Only" echo " 18 - Windows 11 - All"
echo " 19 - Windows 11 - Enterprise Only"
echo " 20 - Windows 11 - Professional Only"
echo "" echo ""
echo " Other:" echo " Other:"
echo "" echo ""
@@ -790,6 +866,8 @@ until [ "$selection" = "0" ]; do
16) clear ; menu_option_16 ; press_enter ;; 16) clear ; menu_option_16 ; press_enter ;;
17) clear ; menu_option_17 ; press_enter ;; 17) clear ; menu_option_17 ; press_enter ;;
18) clear ; menu_option_18 ; press_enter ;; 18) clear ; menu_option_18 ; press_enter ;;
19) clear ; menu_option_19 ; press_enter ;;
20) clear ; menu_option_20 ; press_enter ;;
[Ii] ) clear ; info ; press_enter ;; [Ii] ) clear ; info ; press_enter ;;
[Qq] ) clear ; exit ;; [Qq] ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;; * ) clear ; incorrect_selection ; press_enter ;;

View File

@@ -0,0 +1,85 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# AlmaLinux 10
### Installs from the first attached CD-ROM/DVD on the system.
cdrom
### Performs the kickstart installation in text mode.
### By default, kickstart installations are performed in graphical mode.
text
### Accepts the End User License Agreement.
eula --agreed
### Sets the language to use during installation and the default language to use on the installed system.
lang ${vm_os_language}
### Sets the default keyboard type for the system.
keyboard ${vm_os_keyboard}
### Configure network information for target system and activate network devices in the installer environment (optional)
### --onboot enable device at a boot time
### --device device to be activated and / or configured with the network command
### --bootproto method to obtain networking configuration for device (default dhcp)
### --noipv6 disable IPv6 on this device
${network}
### Lock the root account.
rootpw --lock
### The selected profile will restrict root login.
### Add a user that can login and escalate privileges.
user --name=${build_username} --iscrypted --password=${build_password_encrypted} --groups=wheel
### Configure firewall settings for the system.
### --enabled reject incoming connections that are not in response to outbound requests
### --ssh allow sshd service through the firewall
firewall --enabled --ssh
### Sets up the authentication options for the system.
### The SSSD profile sets sha512 to hash passwords. Passwords are shadowed by default
### See the manual page for authselect-profile for a complete list of possible options.
authselect select sssd
### Sets the state of SELinux on the installed system.
### Defaults to enforcing.
selinux --enforcing
### Sets the system time zone.
timezone ${vm_os_timezone}
### Partitioning
${storage}
### Modifies the default set of services that will run under the default runlevel.
services --enabled=NetworkManager,sshd
### Do not configure X on the installed system.
skipx
### Packages selection.
%packages --ignoremissing --excludedocs
@core
-iwl*firmware
%end
### Post-installation commands.
%post
dnf makecache
dnf install epel-release -y
dnf makecache
dnf install -y sudo qemu-guest-tools
%{ if additional_packages != "" ~}
dnf install -y ${additional_packages}
%{ endif ~}
echo "${build_username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${build_username}
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
%end
### Reboot after the installation is complete.
### --eject attempt to eject the media before rebooting.
reboot --eject

View File

@@ -0,0 +1,5 @@
%{ if ip != null ~}
network --device=${device} --bootproto=static --ip=${ip} --netmask=${cidrnetmask("${ip}/${netmask}")} --gateway=${gateway} --nameserver=${join(",", dns)}
%{ else ~}
network --device=${device} --bootproto=dhcp
%{ endif ~}

View File

@@ -0,0 +1,76 @@
### Sets how the boot loader should be installed.
bootloader --location=mbr
### Initialize any invalid partition tables found on disks.
zerombr
### Removes partitions from the system, prior to creation of new partitions.
### By default, no partitions are removed.
### --all Erases all partitions from the system
### --initlabel Initializes a disk (or disks) by creating a default disk label for all disks in their respective architecture.
clearpart --all --initlabel
### Modify partition sizes for the virtual machine hardware.
### Create primary system partitions.
%{ for partition in partitions ~}
part
%{~ if partition.volume_group != "" ~}
pv.${partition.volume_group}
%{~ else ~}
%{~ if partition.format.fstype == "swap" ~}
swap
%{~ else ~}
${partition.mount.path}
%{~ endif ~}
%{~ if partition.format.fstype != "" ~}
--label=${partition.format.label}
%{~ if partition.format.fstype == "fat32" ~}
--fstype vfat
%{~ else ~}
--fstype ${partition.format.fstype}
%{~ endif ~}
%{~ endif ~}
%{~ endif ~}
%{~ if partition.mount.options != "" ~}
--fsoptions="${partition.mount.options}"
%{~ endif ~}
%{~ if partition.size != -1 ~}
--size=${partition.size}
%{~ else ~}
--size=100 --grow
%{ endif ~}
%{ endfor ~}
%{ if vm_bios == "seabios" ~}
part biosboot --fstype="biosboot" --ondisk=${device} --size=1
%{ endif ~}
### Create a logical volume management (LVM) group.
%{ for index, volume_group in lvm ~}
volgroup sysvg pv.${volume_group.name}
### Modify logical volume sizes for the virtual machine hardware.
### Create logical volumes.
%{ for partition in volume_group.partitions ~}
logvol
%{~ if partition.format.fstype == "swap" ~}
swap
%{~ else ~}
${partition.mount.path}
%{~ endif ~}
--name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label}
%{~ if partition.format.fstype == "fat32" ~}
--fstype vfat
%{~ else ~}
--fstype ${partition.format.fstype}
%{~ endif ~}
%{~ if partition.mount.options != "" ~}
--fsoptions="${partition.mount.options}"
%{~ endif ~}
%{~ if partition.size != -1 ~}
--size=${partition.size}
%{~ else ~}
--size=100 --grow
%{ endif ~}
%{ endfor ~}
%{ endfor ~}

View File

@@ -0,0 +1,234 @@
/*
DESCRIPTION:
AlmaLinux 10 template using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: packer
// The Packer configuration.
packer {
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
}
// BLOCK: data
// Defines the data sources.
data "git-repository" "cwd" {}
// BLOCK: locals
// Defines the local variables.
locals {
bios_boot_command = [
// This sends the "up arrow" key, typically used to navigate through boot menu options.
"<up>",
// This sends the "tab" key. In the BIOS bootloader, this is how you customize the boot options.
"<tab>",
"inst.text biosdevname=0 net.ifnames=0 inst.gpt",
" ${local.data_source_command}",
"<enter><wait>"
]
uefi_boot_command = [
// This sends the "up arrow" key, typically used to navigate through boot menu options.
"<up>",
// This sends the "e" key. In the GRUB boot loader, this is used to edit the selected boot menu option.
"e",
// This sends two "down arrow" keys, followed by the "end" key, and then waits. This is used to navigate to a specific line in the boot menu option's configuration.
"<down><down><end><wait>",
// This types the string "text" followed by the value of the 'data_source_command' local variable.
// This is used to modify the boot menu option's configuration to boot in text mode and specify the kickstart data source configured in the common variables.
"text ${local.data_source_command}",
// This sends the "enter" key, waits, turns on the left control key, sends the "x" key, and then turns off the left control key. This is used to save the changes and exit the boot menu option's configuration, and then continue the boot process.
"<enter><wait><leftCtrlOn>x<leftCtrlOff>"
]
build_by = "Built by: HashiCorp Packer ${packer.version}"
build_date = formatdate("DD-MM-YYYY hh:mm ZZZ", "${timestamp()}" )
build_version = data.git-repository.cwd.head
build_description = "Version: ${local.build_version}\nBuilt on: ${local.build_date}\n${local.build_by}\nCloud-Init: ${var.vm_cloudinit}"
vm_disk_type = var.vm_disk_type == "virtio" ? "vda" : "sda"
manifest_date = formatdate("YYYY-MM-DD hh:mm:ss", timestamp())
manifest_path = "${path.cwd}/manifests/"
manifest_output = "${local.manifest_path}${local.manifest_date}.json"
data_source_content = {
"/ks.cfg" = templatefile("${abspath(path.root)}/data/ks.pkrtpl.hcl", {
build_username = var.build_username
build_password = var.build_password
build_password_encrypted = var.build_password_encrypted
vm_disk_type = local.vm_disk_type
vm_os_language = var.vm_os_language
vm_os_keyboard = var.vm_os_keyboard
vm_os_timezone = var.vm_os_timezone
network = templatefile("${abspath(path.root)}/data/network.pkrtpl.hcl", {
device = var.vm_bridge_interface
ip = var.vm_ip_address
netmask = var.vm_ip_netmask
gateway = var.vm_ip_gateway
dns = var.vm_dns_list
})
common_data_source = var.common_data_source
# lvm needs to be here so late commands can access vg names
#lvm = var.vm_disk_lvm
storage = templatefile("${abspath(path.root)}/data/storage.pkrtpl.hcl", {
device = var.vm_disk_device
swap = var.vm_disk_use_swap
partitions = var.vm_disk_partitions
lvm = var.vm_disk_lvm
vm_bios = var.vm_bios
})
additional_packages = join(" ", var.additional_packages)
})
}
data_source_command = var.common_data_source == "http" ? "inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg" : "inst.ks=/cdrom/ks.cfg"
vm_name = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}"
boot_command = var.vm_bios == "ovmf" ? local.uefi_boot_command : local.bios_boot_command
vm_bios = var.vm_bios == "ovmf" ? var.vm_firmware_path : null
}
// BLOCK: source
// Defines the builder configuration blocks.
source "proxmox-iso" "linux-almalinux" {
// Proxmox Connection Settings and Credentials
proxmox_url = "https://${var.proxmox_hostname}:8006/api2/json"
username = "${var.proxmox_api_token_id}"
token = "${var.proxmox_api_token_secret}"
insecure_skip_tls_verify = "${var.proxmox_insecure_connection}"
// Proxmox Settings
node = "${var.proxmox_node}"
// Virtual Machine Settings
vm_name = "${local.vm_name}"
bios = "${var.vm_bios}"
sockets = "${var.vm_cpu_sockets}"
cores = "${var.vm_cpu_count}"
cpu_type = "${var.vm_cpu_type}"
memory = "${var.vm_mem_size}"
os = "${var.vm_os_type}"
scsi_controller = "${var.vm_disk_controller_type}"
disks {
disk_size = "${var.vm_disk_size}"
type = "${var.vm_disk_type}"
storage_pool = "${var.vm_storage_pool}"
format = "${var.vm_disk_format}"
}
dynamic "efi_config" {
for_each = var.vm_bios == "ovmf" ? [1] : []
content {
efi_storage_pool = var.vm_bios == "ovmf" ? var.vm_efi_storage_pool : null
efi_type = var.vm_bios == "ovmf" ? var.vm_efi_type : null
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true
network_adapters {
bridge = "${var.vm_bridge_interface}"
model = "${var.vm_network_card_model}"
vlan_tag = "${var.vm_vlan_tag}"
}
// Removable Media Settings
http_content = "${var.common_data_source}" == "http" ? "${local.data_source_content}" : null
// Boot and Provisioning Settings
http_interface = var.common_data_source == "http" ? var.common_http_interface : null
http_bind_address = var.common_data_source == "http" ? var.common_http_bind_address : null
http_port_min = var.common_data_source == "http" ? var.common_http_port_min : null
http_port_max = var.common_data_source == "http" ? var.common_http_port_max : null
boot = var.vm_boot
boot_wait = var.vm_boot_wait
boot_command = local.boot_command
boot_iso {
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
unmount = true
iso_checksum = "${var.iso_checksum}"
}
dynamic "additional_iso_files" {
for_each = var.common_data_source == "disk" ? [1] : []
content {
cd_files = var.common_data_source == "disk" ? local.data_source_content : null
cd_label = var.common_data_source == "disk" ? "cidata" : null
iso_storage_pool = var.common_data_source == "disk" ? "local" : null
}
}
template_name = "${local.vm_name}"
template_description = "${local.build_description}"
# VM Cloud Init Settings
cloud_init = var.vm_cloudinit
cloud_init_storage_pool = var.vm_cloudinit == true ? var.vm_storage_pool : null
}
# Build Definition to create the VM Template
build {
sources = ["source.proxmox-iso.linux-almalinux"]
provisioner "ansible" {
user = "${var.build_username}"
galaxy_file = "${path.cwd}/ansible/linux-requirements.yml"
galaxy_force_with_deps = true
playbook_file = "${path.cwd}/ansible/linux-playbook.yml"
roles_path = "${path.cwd}/ansible/roles"
ansible_env_vars = [
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg",
"ANSIBLE_PYTHON_INTERPRETER=/usr/libexec/platform-python"
]
extra_arguments = [
"--extra-vars", "display_skipped_hosts=false",
"--extra-vars", "build_username=${var.build_username}",
"--extra-vars", "build_key='${var.build_key}'",
"--extra-vars", "ansible_username=${var.ansible_username}",
"--extra-vars", "ansible_key='${var.ansible_key}'",
"--extra-vars", "enable_cloudinit='${var.vm_cloudinit}'",
]
}
post-processor "manifest" {
output = local.manifest_output
strip_path = true
strip_time = true
custom_data = {
ansible_username = "${var.ansible_username}"
build_username = "${var.build_username}"
build_date = "${local.build_date}"
build_version = "${local.build_version}"
common_data_source = "${var.common_data_source}"
vm_cpu_sockets = "${var.vm_cpu_sockets}"
vm_cpu_count = "${var.vm_cpu_count}"
vm_disk_size = "${var.vm_disk_size}"
vm_bios = "${var.vm_bios}"
vm_os_type = "${var.vm_os_type}"
vm_mem_size = "${var.vm_mem_size}"
vm_network_card_model = "${var.vm_network_card_model}"
vm_cloudinit = "${var.vm_cloudinit}"
}
}
}

View File

@@ -0,0 +1,40 @@
/*
DESCRIPTION:
AlmaLinux 10 variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// Guest Operating System Metadata
vm_os_language = "en_US"
vm_os_keyboard = "us"
vm_os_timezone = "UTC"
vm_os_family = "linux"
vm_os_name = "almalinux"
vm_os_version = "10"
// Virtual Machine Guest Operating System Setting
vm_os_type = "l26"
vm_cloudinit = true
// Virtual Machine Hardware Settings
vm_bios = "ovmf"
vm_cpu_count = 1
vm_cpu_sockets = 1
vm_cpu_type = "x86-64-v3"
vm_mem_size = 2048
vm_disk_type = "virtio"
vm_disk_size = "32G"
vm_disk_format = "raw"
vm_disk_controller_type = "virtio-scsi-pci"
vm_network_card_model = "virtio"
// Removable Media Settings
iso_path = "iso"
iso_file = "AlmaLinux-10.0-x86_64-dvd.iso"
iso_checksum = "file:https://raw.repo.almalinux.org/almalinux/10/isos/x86_64/CHECKSUM"
// Boot Settings
vm_boot = "order=virtio0;ide2;net0"
vm_boot_wait = "10s"
// EFI Settings
vm_firmware_path = "./OVMF.fd"

View File

@@ -0,0 +1,36 @@
/*
DESCRIPTION:
AlmaLinux 10 network variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// VM Network Settings
variable "vm_network_device" {
type = string
description = "The network device of the VM."
default = "ens192"
}
variable "vm_ip_address" {
type = string
description = "The IP address of the VM (e.g. 172.16.100.192)."
default = null
}
variable "vm_ip_netmask" {
type = number
description = "The netmask of the VM (e.g. 24)."
default = null
}
variable "vm_ip_gateway" {
type = string
description = "The gateway of the VM (e.g. 172.16.100.1)."
default = null
}
variable "vm_dns_list" {
type = list(string)
description = "The nameservers of the VM."
default = []
}

View File

@@ -0,0 +1,53 @@
/*
DESCRIPTION:
AlmaLinux 10 storage variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// VM Storage Settings
variable "vm_disk_device" {
type = string
description = "The device for the virtual disk. (e.g. 'sda')"
}
variable "vm_disk_use_swap" {
type = bool
description = "Whether to use a swap partition."
}
variable "vm_disk_partitions" {
type = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
volume_group = string
}))
description = "The disk partitions for the virtual disk."
}
variable "vm_disk_lvm" {
type = list(object({
name = string
partitions = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
}))
}))
description = "The LVM configuration for the virtual disk."
default = []
}

View File

@@ -0,0 +1,313 @@
/*
DESCRIPTION:
AlmaLinux 10 variables using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: variable
// Defines the input variables.
// Proxmox Credentials
variable "proxmox_hostname" {
type = string
description = "The FQDN or IP address of a Proxmox node. Only one node should be specified in a cluster."
}
variable "proxmox_api_token_id" {
type = string
description = "The token to login to the Proxmox node/cluster. The format is USER@REALM!TOKENID. (e.g. packer@pam!packer_pve_token)"
}
variable "proxmox_api_token_secret" {
type = string
description = "The secret for the API token used to login to the Proxmox API."
# sensitive = true
}
variable "proxmox_insecure_connection" {
description = "true/false to skip Proxmox TLS certificate checks."
type = bool
default = true
}
// Proxmox Settings
variable "proxmox_node" {
type = string
description = "The name of the Proxmox node that Packer will build templates on."
}
// Virtual Machine Settings
variable "vm_os_language" {
type = string
description = "The guest operating system language."
default = "en_US"
}
variable "vm_os_keyboard" {
type = string
description = "The guest operating system keyboard layout."
default = "us"
}
variable "vm_os_timezone" {
type = string
description = "The guest operating system timezone."
default = "UTC"
}
variable "vm_os_family" {
type = string
description = "The guest operating system family. Used for naming. (e.g. 'linux')"
}
variable "vm_os_name" {
type = string
description = "The guest operating system name. Used for naming. (e.g. 'ubuntu')"
}
variable "vm_os_version" {
type = string
description = "The guest operating system version. Used for naming. (e.g. '22-04-lts')"
}
variable "vm_os_type" {
type = string
description = "The guest operating system type. (e.g. 'l26')"
}
variable "vm_bios" {
type = string
description = "The firmware type. Allowed values 'ovmf' or 'seabios'"
default = "ovmf"
validation {
condition = contains(["ovmf", "seabios"], var.vm_bios)
error_message = "The vm_bios value must be 'ovmf' or 'seabios'."
}
}
variable "vm_firmware_path" {
type = string
description = "The firmware file to be used. Needed for EFI"
default = "/usr/share/ovmf/OVMF.fd"
}
variable "vm_efi_storage_pool" {
type = string
description = "Set the UEFI disk storage location. (e.g. 'local-lvm')"
default = "local-lvm"
}
variable "vm_efi_type" {
type = string
description = "Specifies the version of the OVMF firmware to be used. (e.g. '4m')"
default = "4m"
}
variable "vm_efi_pre_enrolled_keys" {
type = bool
description = "Whether Microsoft Standard Secure Boot keys should be pre-loaded on the EFI disk. (e.g. false)"
default = false
}
variable "vm_cpu_count" {
type = number
description = "The number of virtual CPUs. (e.g. '2')"
}
variable "vm_cpu_sockets" {
type = number
description = "The number of virtual CPU sockets. (e.g. '1')"
}
variable "vm_cpu_type" {
type = string
description = "The CPU type to emulate. See the Proxmox API documentation for the complete list of accepted values. For best performance, set this to host. Defaults to kvm64."
}
variable "vm_mem_size" {
type = number
description = "The size for the virtual memory in MB. (e.g. '2048')"
}
variable "vm_disk_controller_type" {
type = string
description = "The SCSI controller model to emulate. (e.g. 'virtio-scsi-pci')"
}
variable "vm_disk_type" {
type = string
description = "The type of disk to emulate. (e.g. 'virtio')"
}
variable "vm_storage_pool" {
type = string
description = "The name of the Proxmox storage pool to store the VM template. (e.g. 'local-lvm')"
}
variable "vm_disk_size" {
type = string
description = "The size for the virtual disk in GB. (e.g. '32G')"
}
variable "vm_disk_format" {
type = string
description = "The format of the file backing the disk. (e.g. 'qcow2')"
}
variable "vm_network_card_model" {
type = string
description = "The model of the virtual network adapter to emulate. (e.g. 'virtio')"
}
variable "vm_bridge_interface" {
type = string
description = "The name of the Proxmox bridge to attach the adapter to."
}
variable "vm_vlan_tag" {
type = string
description = "If the adapter should tag packets, give the VLAN ID. (e.g. '102')"
}
// Cloud-Init Settings
variable "vm_cloudinit" {
type = bool
description = "Enable or disable cloud-init drive in Proxmox. (e.g. false)"
default = false
}
// Removable Media Settings
variable "common_iso_storage" {
type = string
description = "The name of the source Proxmox storage location for ISO images. (e.g. 'local-lvm')"
}
variable "iso_path" {
type = string
description = "The path on the source Proxmox storage location for ISO images. (e.g. 'iso')"
}
variable "iso_file" {
type = string
description = "The file name of the ISO image used by the vendor. (e.g. 'ubuntu-<version>-live-server-amd64.iso')"
}
variable "iso_checksum" {
type = string
description = "The checksum value of the ISO image provided by the vendor."
}
// Boot Settings
variable "common_data_source" {
type = string
description = "The provisioning data source. (e.g. 'http' or 'disk')"
}
variable "common_http_bind_address" {
type = string
description = "Define an IP address on the host to use for the HTTP server."
default = null
}
variable "common_http_interface" {
type = string
description = "Name of the network interface that Packer gets HTTPIP from. Defaults to the first non loopback interface."
default = null
}
variable "common_http_port_min" {
type = number
description = "The start of the HTTP port range."
}
variable "common_http_port_max" {
type = number
description = "The end of the HTTP port range."
}
variable "vm_boot" {
type = string
description = "The boot order for virtual machine devices. (e.g. 'order=virtio0;ide2;net0')"
}
variable "vm_boot_wait" {
type = string
description = "The time to wait after booting the initial VM before typing the boot_command (e.g '10s')"
}
variable "common_ip_wait_timeout" {
type = string
description = "Time to wait for guest operating system IP address response."
}
variable "common_shutdown_timeout" {
type = string
description = "Time to wait for guest operating system shutdown."
}
// Communicator Settings and Credentials
variable "build_username" {
type = string
description = "The username to login to the guest operating system. (e.g. 'ubuntu')"
# sensitive = true
}
variable "build_password" {
type = string
description = "The password to login to the guest operating system."
# sensitive = true
}
variable "build_password_encrypted" {
type = string
description = "The encrypted password to login to the guest operating system."
# sensitive = true
}
variable "build_key" {
type = string
description = "The SSH public key to login to the guest operating system."
# sensitive = true
}
variable "timeout" {
description = "not sure why I need so high a timeout but here we are"
default = "90m"
}
// Ansible Credentials
variable "ansible_username" {
type = string
description = "The username for Ansible to login to the guest operating system. (e.g. 'ansible')"
# sensitive = true
}
variable "ansible_key" {
type = string
description = "The public key for Ansible to login to the guest operating system."
# sensitive = true
}
// HCP Packer Settings
variable "common_hcp_packer_registry_enabled" {
type = bool
description = "Enable the HCP Packer registry."
default = false
}
// Additional Settings
variable "additional_packages" {
type = list(string)
description = "Additional packages to install."
default = []
}

View File

@@ -0,0 +1,85 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Rocky Linux 10
### Installs from the first attached CD-ROM/DVD on the system.
cdrom
### Performs the kickstart installation in text mode.
### By default, kickstart installations are performed in graphical mode.
text
### Accepts the End User License Agreement.
eula --agreed
### Sets the language to use during installation and the default language to use on the installed system.
lang ${vm_os_language}
### Sets the default keyboard type for the system.
keyboard ${vm_os_keyboard}
### Configure network information for target system and activate network devices in the installer environment (optional)
### --onboot enable device at a boot time
### --device device to be activated and / or configured with the network command
### --bootproto method to obtain networking configuration for device (default dhcp)
### --noipv6 disable IPv6 on this device
${network}
### Lock the root account.
rootpw --lock
### The selected profile will restrict root login.
### Add a user that can login and escalate privileges.
user --name=${build_username} --iscrypted --password=${build_password_encrypted} --groups=wheel
### Configure firewall settings for the system.
### --enabled reject incoming connections that are not in response to outbound requests
### --ssh allow sshd service through the firewall
firewall --enabled --ssh
### Sets up the authentication options for the system.
### The SSSD profile sets sha512 to hash passwords. Passwords are shadowed by default
### See the manual page for authselect-profile for a complete list of possible options.
authselect select sssd
### Sets the state of SELinux on the installed system.
### Defaults to enforcing.
selinux --enforcing
### Sets the system time zone.
timezone ${vm_os_timezone}
### Partitioning
${storage}
### Modifies the default set of services that will run under the default runlevel.
services --enabled=NetworkManager,sshd
### Do not configure X on the installed system.
skipx
### Packages selection.
%packages --ignoremissing --excludedocs
@core
-iwl*firmware
%end
### Post-installation commands.
%post
dnf makecache
dnf install epel-release -y
dnf makecache
dnf install -y sudo qemu-guest-tools
%{ if additional_packages != "" ~}
dnf install -y ${additional_packages}
%{ endif ~}
echo "${build_username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${build_username}
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
%end
### Reboot after the installation is complete.
### --eject attempt to eject the media before rebooting.
reboot --eject

View File

@@ -0,0 +1,5 @@
%{ if ip != null ~}
network --device=${device} --bootproto=static --ip=${ip} --netmask=${cidrnetmask("${ip}/${netmask}")} --gateway=${gateway} --nameserver=${join(",", dns)}
%{ else ~}
network --device=${device} --bootproto=dhcp
%{ endif ~}

View File

@@ -0,0 +1,73 @@
### Sets how the boot loader should be installed.
bootloader --location=mbr
### Initialize any invalid partition tables found on disks.
zerombr
### Removes partitions from the system, prior to creation of new partitions.
### By default, no partitions are removed.
### --all Erases all partitions from the system
### --initlabel Initializes a disk (or disks) by creating a default disk label for all disks in their respective architecture.
clearpart --all --initlabel
### Modify partition sizes for the virtual machine hardware.
### Create primary system partitions.
%{ for partition in partitions ~}
part
%{~ if partition.volume_group != "" ~}
pv.${partition.volume_group}
%{~ else ~}
%{~ if partition.format.fstype == "swap" ~}
swap
%{~ else ~}
${partition.mount.path}
%{~ endif ~}
%{~ if partition.format.fstype != "" ~}
--label=${partition.format.label}
%{~ if partition.format.fstype == "fat32" ~}
--fstype vfat
%{~ else ~}
--fstype ${partition.format.fstype}
%{~ endif ~}
%{~ endif ~}
%{~ endif ~}
%{~ if partition.mount.options != "" ~}
--fsoptions="${partition.mount.options}"
%{~ endif ~}
%{~ if partition.size != -1 ~}
--size=${partition.size}
%{~ else ~}
--size=100 --grow
%{ endif ~}
%{ endfor ~}
### Create a logical volume management (LVM) group.
%{ for index, volume_group in lvm ~}
volgroup sysvg pv.${volume_group.name}
### Modify logical volume sizes for the virtual machine hardware.
### Create logical volumes.
%{ for partition in volume_group.partitions ~}
logvol
%{~ if partition.format.fstype == "swap" ~}
swap
%{~ else ~}
${partition.mount.path}
%{~ endif ~}
--name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label}
%{~ if partition.format.fstype == "fat32" ~}
--fstype vfat
%{~ else ~}
--fstype ${partition.format.fstype}
%{~ endif ~}
%{~ if partition.mount.options != "" ~}
--fsoptions="${partition.mount.options}"
%{~ endif ~}
%{~ if partition.size != -1 ~}
--size=${partition.size}
%{~ else ~}
--size=100 --grow
%{ endif ~}
%{ endfor ~}
%{ endfor ~}

View File

@@ -0,0 +1,234 @@
/*
DESCRIPTION:
Rocky Linux 10 template using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: packer
// The Packer configuration.
packer {
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
}
// BLOCK: data
// Defines the data sources.
data "git-repository" "cwd" {}
// BLOCK: locals
// Defines the local variables.
locals {
bios_boot_command = [
"<up><wait>",
"<tab><wait>",
" text ${local.data_source_command}",
"<enter><wait>"
]
uefi_boot_command = [
// This sends the "up arrow" key, typically used to navigate through boot menu options.
"<up>",
// This sends the "e" key. In the GRUB boot loader, this is used to edit the selected boot menu option.
"e",
// This sends two "down arrow" keys, followed by the "end" key, and then waits. This is used to navigate to a specific line in the boot menu option's configuration.
"<down><down><end><wait>",
// This types the string "text" followed by the value of the 'data_source_command' local variable.
// This is used to modify the boot menu option's configuration to boot in text mode and specify the kickstart data source configured in the common variables.
"text ${local.data_source_command}",
// This sends the "enter" key, waits, turns on the left control key, sends the "x" key, and then turns off the left control key. This is used to save the changes and exit the boot menu option's configuration, and then continue the boot process.
"<enter><wait><leftCtrlOn>x<leftCtrlOff>"
]
build_by = "Built by: HashiCorp Packer ${packer.version}"
build_date = formatdate("DD-MM-YYYY hh:mm ZZZ", "${timestamp()}" )
build_version = data.git-repository.cwd.head
build_description = "Version: ${local.build_version}\nBuilt on: ${local.build_date}\n${local.build_by}\nCloud-Init: ${var.vm_cloudinit}"
vm_disk_type = var.vm_disk_type == "virtio" ? "vda" : "sda"
manifest_date = formatdate("YYYY-MM-DD hh:mm:ss", timestamp())
manifest_path = "${path.cwd}/manifests/"
manifest_output = "${local.manifest_path}${local.manifest_date}.json"
data_source_content = {
"/ks.cfg" = templatefile("${abspath(path.root)}/data/ks.pkrtpl.hcl", {
build_username = var.build_username
build_password = var.build_password
build_password_encrypted = var.build_password_encrypted
vm_disk_type = local.vm_disk_type
vm_os_language = var.vm_os_language
vm_os_keyboard = var.vm_os_keyboard
vm_os_timezone = var.vm_os_timezone
vm_cloudinit = var.vm_cloudinit
network = templatefile("${abspath(path.root)}/data/network.pkrtpl.hcl", {
device = var.vm_bridge_interface
ip = var.vm_ip_address
netmask = var.vm_ip_netmask
gateway = var.vm_ip_gateway
dns = var.vm_dns_list
})
common_data_source = var.common_data_source
# lvm needs to be here so late commands can access vg names
lvm = var.vm_disk_lvm
storage = templatefile("${abspath(path.root)}/data/storage.pkrtpl.hcl", {
device = var.vm_disk_device
swap = var.vm_disk_use_swap
partitions = var.vm_disk_partitions
lvm = var.vm_disk_lvm
vm_bios = var.vm_bios
})
additional_packages = join(" ", var.additional_packages)
})
}
data_source_command = var.common_data_source == "http" ? "inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg" : "inst.ks=/cdrom/ks.cfg"
vm_name = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}"
boot_command = var.vm_bios == "ovmf" ? local.uefi_boot_command : local.bios_boot_command
vm_bios = var.vm_bios == "ovmf" ? var.vm_firmware_path : null
}
// BLOCK: source
// Defines the builder configuration blocks.
source "proxmox-iso" "linux-rocky" {
// Proxmox Connection Settings and Credentials
proxmox_url = "https://${var.proxmox_hostname}:8006/api2/json"
username = "${var.proxmox_api_token_id}"
token = "${var.proxmox_api_token_secret}"
insecure_skip_tls_verify = "${var.proxmox_insecure_connection}"
// Proxmox Settings
node = "${var.proxmox_node}"
// Virtual Machine Settings
vm_name = "${local.vm_name}"
bios = "${var.vm_bios}"
sockets = "${var.vm_cpu_sockets}"
cores = "${var.vm_cpu_count}"
cpu_type = "${var.vm_cpu_type}"
memory = "${var.vm_mem_size}"
os = "${var.vm_os_type}"
scsi_controller = "${var.vm_disk_controller_type}"
disks {
disk_size = "${var.vm_disk_size}"
type = "${var.vm_disk_type}"
storage_pool = "${var.vm_storage_pool}"
format = "${var.vm_disk_format}"
}
dynamic "efi_config" {
for_each = var.vm_bios == "ovmf" ? [1] : []
content {
efi_storage_pool = var.vm_bios == "ovmf" ? var.vm_efi_storage_pool : null
efi_type = var.vm_bios == "ovmf" ? var.vm_efi_type : null
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true
network_adapters {
bridge = "${var.vm_bridge_interface}"
model = "${var.vm_network_card_model}"
vlan_tag = "${var.vm_vlan_tag}"
}
// Removable Media Settings
http_content = "${var.common_data_source}" == "http" ? "${local.data_source_content}" : null
// Boot and Provisioning Settings
http_interface = var.common_data_source == "http" ? var.common_http_interface : null
http_bind_address = var.common_data_source == "http" ? var.common_http_bind_address : null
http_port_min = var.common_data_source == "http" ? var.common_http_port_min : null
http_port_max = var.common_data_source == "http" ? var.common_http_port_max : null
boot = var.vm_boot
boot_wait = var.vm_boot_wait
boot_command = local.boot_command
boot_iso {
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
unmount = true
iso_checksum = "${var.iso_checksum}"
}
dynamic "additional_iso_files" {
for_each = var.common_data_source == "disk" ? [1] : []
content {
cd_files = var.common_data_source == "disk" ? local.data_source_content : null
cd_label = var.common_data_source == "disk" ? "cidata" : null
iso_storage_pool = var.common_data_source == "disk" ? "local" : null
}
}
template_name = "${local.vm_name}"
template_description = "${local.build_description}"
# VM Cloud Init Settings
cloud_init = var.vm_cloudinit
cloud_init_storage_pool = var.vm_cloudinit == true ? var.vm_storage_pool : null
}
# Build Definition to create the VM Template
build {
sources = ["source.proxmox-iso.linux-rocky"]
provisioner "ansible" {
user = "${var.build_username}"
galaxy_file = "${path.cwd}/ansible/linux-requirements.yml"
galaxy_force_with_deps = true
playbook_file = "${path.cwd}/ansible/linux-playbook.yml"
roles_path = "${path.cwd}/ansible/roles"
ansible_env_vars = [
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg",
"ANSIBLE_PYTHON_INTERPRETER=/usr/libexec/platform-python"
]
extra_arguments = [
"--extra-vars", "display_skipped_hosts=false",
"--extra-vars", "build_username=${var.build_username}",
"--extra-vars", "build_key='${var.build_key}'",
"--extra-vars", "ansible_username=${var.ansible_username}",
"--extra-vars", "ansible_key='${var.ansible_key}'",
"--extra-vars", "enable_cloudinit='${var.vm_cloudinit}'",
]
}
post-processor "manifest" {
output = local.manifest_output
strip_path = true
strip_time = true
custom_data = {
ansible_username = "${var.ansible_username}"
build_username = "${var.build_username}"
build_date = "${local.build_date}"
build_version = "${local.build_version}"
common_data_source = "${var.common_data_source}"
vm_cpu_sockets = "${var.vm_cpu_sockets}"
vm_cpu_count = "${var.vm_cpu_count}"
vm_disk_size = "${var.vm_disk_size}"
vm_bios = "${var.vm_bios}"
vm_os_type = "${var.vm_os_type}"
vm_mem_size = "${var.vm_mem_size}"
vm_network_card_model = "${var.vm_network_card_model}"
vm_cloud_init_enable = "${var.vm_cloudinit}"
}
}
}

View File

@@ -0,0 +1,40 @@
/*
DESCRIPTION:
Rocky Linux 10 variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// Guest Operating System Metadata
vm_os_language = "en_US"
vm_os_keyboard = "us"
vm_os_timezone = "UTC"
vm_os_family = "linux"
vm_os_name = "rocky"
vm_os_version = "10"
// Virtual Machine Guest Operating System Setting
vm_os_type = "l26"
vm_cloudinit = true
// Virtual Machine Hardware Settings
vm_bios = "ovmf"
vm_cpu_count = 1
vm_cpu_sockets = 1
vm_cpu_type = "x86-64-v2-AES"
vm_mem_size = 2048
vm_disk_type = "virtio"
vm_disk_size = "32G"
vm_disk_format = "raw"
vm_disk_controller_type = "virtio-scsi-pci"
vm_network_card_model = "virtio"
// Removable Media Settings
iso_path = "iso"
iso_file = "Rocky-10.0-x86_64-dvd1.iso"
iso_checksum = "file:https://download.rockylinux.org/pub/rocky/10/isos/x86_64/CHECKSUM"
// Boot Settings
vm_boot = "order=virtio0;ide2;net0"
vm_boot_wait = "10s"
// EFI Settings
vm_firmware_path = "./OVMF.fd"

View File

@@ -0,0 +1,36 @@
/*
DESCRIPTION:
Rocky Linux 10 network variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// VM Network Settings
variable "vm_network_device" {
type = string
description = "The network device of the VM."
default = "ens192"
}
variable "vm_ip_address" {
type = string
description = "The IP address of the VM (e.g. 172.16.100.192)."
default = null
}
variable "vm_ip_netmask" {
type = number
description = "The netmask of the VM (e.g. 24)."
default = null
}
variable "vm_ip_gateway" {
type = string
description = "The gateway of the VM (e.g. 172.16.100.1)."
default = null
}
variable "vm_dns_list" {
type = list(string)
description = "The nameservers of the VM."
default = []
}

View File

@@ -0,0 +1,53 @@
/*
DESCRIPTION:
Rocky Linux 10 storage variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// VM Storage Settings
variable "vm_disk_device" {
type = string
description = "The device for the virtual disk. (e.g. 'sda')"
}
variable "vm_disk_use_swap" {
type = bool
description = "Whether to use a swap partition."
}
variable "vm_disk_partitions" {
type = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
volume_group = string
}))
description = "The disk partitions for the virtual disk."
}
variable "vm_disk_lvm" {
type = list(object({
name = string
partitions = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
}))
}))
description = "The LVM configuration for the virtual disk."
default = []
}

View File

@@ -0,0 +1,313 @@
/*
DESCRIPTION:
Rocky Linux 10 variables using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: variable
// Defines the input variables.
// Proxmox Credentials
variable "proxmox_hostname" {
type = string
description = "The FQDN or IP address of a Proxmox node. Only one node should be specified in a cluster."
}
variable "proxmox_api_token_id" {
type = string
description = "The token to login to the Proxmox node/cluster. The format is USER@REALM!TOKENID. (e.g. packer@pam!packer_pve_token)"
}
variable "proxmox_api_token_secret" {
type = string
description = "The secret for the API token used to login to the Proxmox API."
# sensitive = true
}
variable "proxmox_insecure_connection" {
description = "true/false to skip Proxmox TLS certificate checks."
type = bool
default = true
}
// Proxmox Settings
variable "proxmox_node" {
type = string
description = "The name of the Proxmox node that Packer will build templates on."
}
// Virtual Machine Settings
variable "vm_os_language" {
type = string
description = "The guest operating system language."
default = "en_US"
}
variable "vm_os_keyboard" {
type = string
description = "The guest operating system keyboard layout."
default = "us"
}
variable "vm_os_timezone" {
type = string
description = "The guest operating system timezone."
default = "UTC"
}
variable "vm_os_family" {
type = string
description = "The guest operating system family. Used for naming. (e.g. 'linux')"
}
variable "vm_os_name" {
type = string
description = "The guest operating system name. Used for naming. (e.g. 'ubuntu')"
}
variable "vm_os_version" {
type = string
description = "The guest operating system version. Used for naming. (e.g. '22-04-lts')"
}
variable "vm_os_type" {
type = string
description = "The guest operating system type. (e.g. 'l26')"
}
variable "vm_bios" {
type = string
description = "The firmware type. Allowed values 'ovmf' or 'seabios'"
default = "ovmf"
validation {
condition = contains(["ovmf", "seabios"], var.vm_bios)
error_message = "The vm_bios value must be 'ovmf' or 'seabios'."
}
}
variable "vm_firmware_path" {
type = string
description = "The firmware file to be used. Needed for EFI"
default = "/usr/share/ovmf/OVMF.fd"
}
variable "vm_efi_storage_pool" {
type = string
description = "Set the UEFI disk storage location. (e.g. 'local-lvm')"
default = "local-lvm"
}
variable "vm_efi_type" {
type = string
description = "Specifies the version of the OVMF firmware to be used. (e.g. '4m')"
default = "4m"
}
variable "vm_efi_pre_enrolled_keys" {
type = bool
description = "Whether Microsoft Standard Secure Boot keys should be pre-loaded on the EFI disk. (e.g. false)"
default = false
}
variable "vm_cpu_count" {
type = number
description = "The number of virtual CPUs. (e.g. '2')"
}
variable "vm_cpu_sockets" {
type = number
description = "The number of virtual CPU sockets. (e.g. '1')"
}
variable "vm_cpu_type" {
type = string
description = "The CPU type to emulate. See the Proxmox API documentation for the complete list of accepted values. For best performance, set this to host. Defaults to kvm64."
}
variable "vm_mem_size" {
type = number
description = "The size for the virtual memory in MB. (e.g. '2048')"
}
variable "vm_disk_controller_type" {
type = string
description = "The SCSI controller model to emulate. (e.g. 'virtio-scsi-pci')"
}
variable "vm_disk_type" {
type = string
description = "The type of disk to emulate. (e.g. 'virtio')"
}
variable "vm_storage_pool" {
type = string
description = "The name of the Proxmox storage pool to store the VM template. (e.g. 'local-lvm')"
}
variable "vm_disk_size" {
type = string
description = "The size for the virtual disk in GB. (e.g. '32G')"
}
variable "vm_disk_format" {
type = string
description = "The format of the file backing the disk. (e.g. 'qcow2')"
}
variable "vm_network_card_model" {
type = string
description = "The model of the virtual network adapter to emulate. (e.g. 'virtio')"
}
variable "vm_bridge_interface" {
type = string
description = "The name of the Proxmox bridge to attach the adapter to."
}
variable "vm_vlan_tag" {
type = string
description = "If the adapter should tag packets, give the VLAN ID. (e.g. '102')"
}
// Cloud-Init Settings
variable "vm_cloudinit" {
type = bool
description = "Enable or disable cloud-init drive in Proxmox. (e.g. false)"
default = false
}
// Removable Media Settings
variable "common_iso_storage" {
type = string
description = "The name of the source Proxmox storage location for ISO images. (e.g. 'local-lvm')"
}
variable "iso_path" {
type = string
description = "The path on the source Proxmox storage location for ISO images. (e.g. 'iso')"
}
variable "iso_file" {
type = string
description = "The file name of the ISO image used by the vendor. (e.g. 'ubuntu-<version>-live-server-amd64.iso')"
}
variable "iso_checksum" {
type = string
description = "The checksum value of the ISO image provided by the vendor."
}
// Boot Settings
variable "common_data_source" {
type = string
description = "The provisioning data source. (e.g. 'http' or 'disk')"
}
variable "common_http_bind_address" {
type = string
description = "Define an IP address on the host to use for the HTTP server."
default = null
}
variable "common_http_interface" {
type = string
description = "Name of the network interface that Packer gets HTTPIP from. Defaults to the first non loopback interface."
default = null
}
variable "common_http_port_min" {
type = number
description = "The start of the HTTP port range."
}
variable "common_http_port_max" {
type = number
description = "The end of the HTTP port range."
}
variable "vm_boot" {
type = string
description = "The boot order for virtual machine devices. (e.g. 'order=virtio0;ide2;net0')"
}
variable "vm_boot_wait" {
type = string
description = "The time to wait after booting the initial VM before typing the boot_command (e.g '10s')"
}
variable "common_ip_wait_timeout" {
type = string
description = "Time to wait for guest operating system IP address response."
}
variable "common_shutdown_timeout" {
type = string
description = "Time to wait for guest operating system shutdown."
}
// Communicator Settings and Credentials
variable "build_username" {
type = string
description = "The username to login to the guest operating system. (e.g. 'ubuntu')"
# sensitive = true
}
variable "build_password" {
type = string
description = "The password to login to the guest operating system."
# sensitive = true
}
variable "build_password_encrypted" {
type = string
description = "The encrypted password to login to the guest operating system."
# sensitive = true
}
variable "build_key" {
type = string
description = "The SSH public key to login to the guest operating system."
# sensitive = true
}
variable "timeout" {
description = "not sure why I need so high a timeout but here we are"
default = "90m"
}
// Ansible Credentials
variable "ansible_username" {
type = string
description = "The username for Ansible to login to the guest operating system. (e.g. 'ansible')"
# sensitive = true
}
variable "ansible_key" {
type = string
description = "The public key for Ansible to login to the guest operating system."
# sensitive = true
}
// HCP Packer Settings
variable "common_hcp_packer_registry_enabled" {
type = bool
description = "Enable the HCP Packer registry."
default = false
}
// Additional Settings
variable "additional_packages" {
type = list(string)
description = "Additional packages to install."
default = []
}

View File

@@ -16,6 +16,7 @@ SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}") CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}")
INPUT_PATHS=( INPUT_PATHS=(
"$SCRIPT_PATH/builds/linux/almalinux/10/"
"$SCRIPT_PATH/builds/linux/almalinux/9/" "$SCRIPT_PATH/builds/linux/almalinux/9/"
"$SCRIPT_PATH/builds/linux/almalinux/8/" "$SCRIPT_PATH/builds/linux/almalinux/8/"
"$SCRIPT_PATH/builds/linux/centos/10-stream/" "$SCRIPT_PATH/builds/linux/centos/10-stream/"
@@ -26,6 +27,7 @@ INPUT_PATHS=(
"$SCRIPT_PATH/builds/linux/opensuse/leap-15-5/" "$SCRIPT_PATH/builds/linux/opensuse/leap-15-5/"
"$SCRIPT_PATH/builds/linux/oracle/9/" "$SCRIPT_PATH/builds/linux/oracle/9/"
"$SCRIPT_PATH/builds/linux/oracle/8/" "$SCRIPT_PATH/builds/linux/oracle/8/"
"$SCRIPT_PATH/builds/linux/rocky/10/"
"$SCRIPT_PATH/builds/linux/rocky/9/" "$SCRIPT_PATH/builds/linux/rocky/9/"
"$SCRIPT_PATH/builds/linux/rocky/8/" "$SCRIPT_PATH/builds/linux/rocky/8/"
"$SCRIPT_PATH/builds/linux/ubuntu/24-04-lts/" "$SCRIPT_PATH/builds/linux/ubuntu/24-04-lts/"
@@ -60,6 +62,8 @@ validate_packer() {
"$CONFIG_PATH/$current_build_vars" "$CONFIG_PATH/$current_build_vars"
) )
else else
current_build_path=${input_path#"${SCRIPT_PATH}/builds/"}
current_build_vars="$(echo "${current_build_path%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
VAR_FILES=( VAR_FILES=(
"$CONFIG_PATH/ansible.pkrvars.hcl" "$CONFIG_PATH/ansible.pkrvars.hcl"
"$CONFIG_PATH/build.pkrvars.hcl" "$CONFIG_PATH/build.pkrvars.hcl"
@@ -68,6 +72,7 @@ validate_packer() {
"$CONFIG_PATH/network.pkrvars.hcl" "$CONFIG_PATH/network.pkrvars.hcl"
"$CONFIG_PATH/proxmox.pkrvars.hcl" "$CONFIG_PATH/proxmox.pkrvars.hcl"
"$CONFIG_PATH/proxy.pkrvars.hcl" "$CONFIG_PATH/proxy.pkrvars.hcl"
"$CONFIG_PATH/$current_build_vars"
) )
fi fi