Merge branch 'develop' of github.com:ajschroeder/proxmox-packer-examples into develop

This commit is contained in:
AJ Schroeder
2025-06-10 22:11:02 +00:00
59 changed files with 892 additions and 305 deletions

16
.gitignore vendored
View File

@@ -5,21 +5,27 @@
**/credentials*
# Configurations
## Ignore default config directory.
# Ignore default config directory.
config/
# Manifests
## Ignore manifests directory.
# Ignore manifests directory.
manifests/*.json
# MacOS
## Ignore desktop services files.
# Ignore desktop services files.
**/.DS_Store
# Certificates and Keys
## Ignore certificates files.
# Ignore certificates files.
**/*.cer
**/*.crt
**/*.p7b
## Ignore public key files
# Ignore public key files
**/*.pub
# Ignore packer plugin files
plugin.hwm
plugin.pwd
plugin.pwi

View File

@@ -27,18 +27,20 @@ The following builds are available:
| :--- | :--- | :---: | :---: | :---: | :---: |
| AlmaLinux | 9 | ✓ | ✓ | ✓ | |
| AlmaLinux | 8 | ✓ | ✓ | ✓ | |
| CentOS Stream | 9 | ✓ | ✓ | | |
| Debian | 12 | ✓ | | | |
| Debian | 11 | ✓ | | | |
| Oracle Linux | 9 | ✓ | | | |
| Oracle Linux | 8 | ✓ | | | |
| Rocky Linux | 9 | ✓ | | | |
| Rocky Linux | 8 | ✓ | | | |
| OpenSUSE Leap | 15.6 | ✓ | | | |
| OpenSUSE Leap | 15.5 | ✓ | | | |
| Ubuntu Server | 24.04 LTS | ✓ | | | |
| Ubuntu Server | 22.04 LTS | ✓ | | | |
| CentOS Stream | 10 | ✓ | ✓ | ✓ | ✓ |
| CentOS Stream | 9 | ✓ | ✓ | ✓ | ✓ |
| Debian | 12 | ✓ | ✓ | ✓ | ✓ |
| Debian | 11 | ✓ | ✓ | ✓ | ✓ |
| OpenSUSE Leap | 15.6 | ✓ | ✓ | ✓ | ✓ |
| OpenSUSE Leap | 15.5 | ✓ | ✓ | ✓ | ✓ |
| Oracle Linux | 9 | ✓ | ✓ | ✓ | ✓ |
| Oracle Linux | 8 | ✓ | ✓ | ✓ | ✓ |
| Rocky Linux | 9 | ✓ | ✓ | ✓ | ✓ |
| Rocky Linux | 8 | ✓ | ✓ | ✓ | ✓ |
| Ubuntu Server | 24.04 LTS | ✓ | ✓ | ✓ | ✓ |
| Ubuntu Server | 22.04 LTS | ✓ | ✓ | ✓ | ✓ |
| Ubuntu Server | 20.04 LTS | ✓ | ✓ | ✓ | ✓ |
| Windows Desktop | 11 | | | ✓ | N/A |
## Requirements
@@ -52,7 +54,7 @@ Operating systems and versions tested with the project:
**Packer**:
- HashiCorp [Packer][packer-install] 1.11.0 or higher.
- HashiCorp [Packer][packer-install] 1.12.0 or higher.
> **Note**
>
@@ -121,12 +123,12 @@ Operating systems and versions tested with the project:
>
> Required plugins are automatically downloaded and initialized when using `./build.sh`. For dark sites, you may download the plugins and place these same directory as your Packer executable `/usr/local/bin` or `$HOME/.packer.d/plugins`.
- HashiCorp [Packer Plugin for Proxmox][packer-plugin-proxmox] 1.1.8 or later.
- [Packer Plugin for Git][packer-plugin-git] 0.6.2 or later - a community plugin for HashiCorp Packer.
- HashiCorp [Packer Plugin for Proxmox-ISO][packer-plugin-proxmox] version 1.2.1 - the plugin for HashiCorp Packer to communicate with Proxmox VE. This needs to be pinned to version 1.2.1 at this time due to a [CPU bug](https://github.com/hashicorp/packer-plugin-proxmox/issues/307).
**Ansible**:
- [Ansible][ansible] [Core][ansible-core] version 2.10 or higher.
- [Ansible][ansible] [Core][ansible-core] version 2.14 or higher.
> **Note**
>
@@ -165,12 +167,12 @@ Operating systems and versions tested with the project:
- <details>
<summary>CentOS Stream 9</summary>
It is recommended that you install ansible-core using your system's package manager instead of via pip.
It is recommended that you install ansible using your system's package manager instead of via pip.
Install.
```shell
dnf -y install ansible-core
dnf -y install ansible
```
</details>
@@ -263,7 +265,7 @@ You will need to generate a SHA-512 encrypted password for the `build_password_e
Run the following command to generate a SHA-512 encrypted password:
```shell
mkpasswd -m sha512
mkpasswd -m sha512crypt
```
The following output is displayed:
@@ -316,7 +318,8 @@ common_iso_storage = "<Proxmox Storage Location>"
// Boot and Provisioning Settings
common_data_source = "http"
common_http_ip = null
common_http_interface = null
common_http_bind_address = null
common_http_port_min = 8000
common_http_port_max = 8099
common_ip_wait_timeout = "20m"
@@ -359,21 +362,42 @@ common_data_source = "disk"
The Packer plugin's `cd_content` option is used when selecting `disk` unless the distribution does not support a secondary CD-ROM.
#### HTTP Binding
#### HTTP Interface
If you need to define a specific IPv4 address from your host for Packer's built-in HTTP server, modify the `common_http_ip` variable from `null` to a `string` value that matches an IP address on your Packer host.
Name of the network interface that Packer gets `HTTPIP` from. Defaults to the first non loopback interface.
```hcl title="config/common.pkrvars.hcl"
common_http_ip = "172.16.11.254"
common_http_interface = "eth2"
```
#### HTTP Bind Address
IP address on the build server to bind the Packer HTTP instance to. Must be an interface that is reachable from the Proxmox server.
```hcl title="config/common.pkrvars.hcl"
common_http_bind_address = 172.16.15.97"
```
### Network Variables
Configuring a static IP address under the `configs/network.pkrvars.hcl` file is supported. If you want to use DHCP for the templates then leave these variables commented out. The default is DHCP.
Edit the `config/network.pkrvars.hcl` file to configure the following:
- Static IP address settings
#### Proxmox Specific Network Variables for VM Templates
These variables are used by Packer to configure the network interface for the VM template. These are specific to your environment. For example, to use the default `vmbr0` interface and the tag for VLAN 102, you would set it as follows:
```hcl title="config/network.pkrvars.hcl"
// Proxmox settings for VM templates
vm_bridge_interface = "vmbr0"
vm_vlan_tag = "102"
```
Configuring a static IP address under the `configs/network.pkrvars.hcl` file is supported. If you want to use DHCP for the templates then leave these variables commented out. The default is DHCP.
> **Note**
>
> - These settings are site specific for each Proxmox host and are going to be needed regardless if you use DHCP or static IP addresses.
#### Static IP address settings
The Packer build templates default to using DHCP, however, you can use static IP addressing for your VM templates. Simply uncomment the following vars and configure to your specific requirements:
```hcl title="config/network.pkrvars.hcl"
vm_ip_address = "192.168.101.100"
@@ -382,6 +406,10 @@ vm_ip_gateway = "192.168.101.1"
vm_dns_list = [ "8.8.8.8", "8.8.4.4" ]
```
> **Note**
>
> - If you need/want to go back to using DHCP, just comment these variables out again and the templates should go back to using DHCP.
### Proxmox Variables
Edit the `config/proxmox.pkrvars.hcl` file to configure the following:
@@ -390,12 +418,12 @@ Edit the `config/proxmox.pkrvars.hcl` file to configure the following:
```hcl title="config/proxmox.pkrvars.hcl"
// Proxmox Credentials
proxmox_api_url = "<FQDN or IP of proxmox server>"
proxmox_api_token_id = "name@realm!token"
proxmox_api_token_secret = "<token secret>"
proxmox_insecure_connection = false
// Proxmox Settings
// Proxmox Specific Settings
proxmox_hostname = "<FQDN or IP of proxmox server>"
proxmox_node = "<proxmox node name>"
```

View File

@@ -1,2 +1,6 @@
---
enable_cloudinit: false
base_chocolatey_packages:
- firefox
- putty

View File

@@ -6,46 +6,13 @@
ansible.builtin.debug:
msg: "OS: {{ ansible_os_name }}"
- name: Ensure .NET Framework 4.8 requirement is satisfied for Chocolatey v2.0.0 and later
when: ansible_os_installation_type != "Server Core"
block:
- name: Install Chocolatey CLI
chocolatey.chocolatey.win_chocolatey:
name: chocolatey
state: present
version: 1.4.0
- name: Install Microsoft .NET Framework 4.8
chocolatey.chocolatey.win_chocolatey:
name: netfx-4.8
state: present
- name: Reboot the host to complete .NET Framework 4.8 install
ansible.windows.win_reboot:
- name: Install latest version of Chocolatey
- name: Install latest version of Chocolatey
chocolatey.chocolatey.win_chocolatey:
name: chocolatey
state: latest
- name: Installing additional packages using Chocolatey
- name: Installing additional packages using Chocolatey
chocolatey.chocolatey.win_chocolatey:
name:
- googlechrome
- putty
name: "{{ item }}"
state: latest
ignore_checksums: true
- name: Updating the operating system
ansible.windows.win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
reject_list:
- 5034439
- 5034441
reboot: true
register: win_updates
until: not win_updates.failed
retries: 5
delay: 300
loop: "{{ base_chocolatey_packages }}"

342
build.sh
View File

@@ -4,11 +4,55 @@ set -e
source common.sh
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "Usage: script.sh [OPTIONS] [CONFIG_PATH]"
echo ""
echo "Options:"
echo " -h, --help Show this help message and exit."
echo " -d, --debug Run builds in debug mode."
echo ""
echo "Arguments:"
echo " CONFIG_PATH Path to the configuration directory."
echo ""
echo "Examples:"
echo " ./build.sh"
echo " ./build.sh --help"
echo " ./build.sh --debug"
echo " ./build.sh config"
echo " ./build.sh us-west-1"
echo " ./build.sh --debug config"
echo " ./build.sh --debug us-west-1"
exit 0
fi
if [ "$1" == "--debug" ] || [ "$1" == "-d" ]; then
debug_mode=true
debug_option="-debug"
shift
else
debug_mode=false
debug_option=""
fi
SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}")
if [ -n "$1" ]; then
CONFIG_PATH=$(realpath "$1")
else
CONFIG_PATH=$(realpath "${SCRIPT_PATH}/config")
fi
menu_message="Select a HashiCorp Packer build for Proxmox."
if [ "$debug_mode" = true ]; then
menu_message+=" \e[31m(Debug Mode)\e[0m"
fi
menu_option_1() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a AlmaLinux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -26,13 +70,15 @@ menu_option_1() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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. ###
@@ -41,6 +87,9 @@ menu_option_1() {
menu_option_2() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a AlmaLinux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -58,13 +107,15 @@ menu_option_2() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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. ###
@@ -72,7 +123,47 @@ menu_option_2() {
}
menu_option_3() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/10-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a CentOS 10 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a CentOS 10 Stream Template for Proxmox. ###
echo "Building a CentOS 10 Stream 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_4() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/9-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a CentOS 9 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -90,21 +181,26 @@ menu_option_3() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_4() {
menu_option_5() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/12/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Debian 12 (Bookworm) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -122,21 +218,26 @@ menu_option_4() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_5() {
menu_option_6() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Debian 11 (Bullseye) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -154,21 +255,26 @@ menu_option_5() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_6() {
menu_option_7() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-6/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a OpenSUSE Leap 15.6 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -186,21 +292,26 @@ menu_option_6() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_7() {
menu_option_8() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-5/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a OpenSUSE Leap 15.5 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -218,21 +329,26 @@ menu_option_7() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_8() {
menu_option_9() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Oracle Linux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -250,21 +366,26 @@ menu_option_8() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_9() {
menu_option_10() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Oracle Linux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -282,21 +403,26 @@ menu_option_9() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_10() {
menu_option_11() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -314,21 +440,26 @@ menu_option_10() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_11() {
menu_option_12() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -346,21 +477,26 @@ menu_option_11() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_12() {
menu_option_13() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/24-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 24.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -378,21 +514,26 @@ menu_option_12() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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() {
menu_option_14() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -410,21 +551,26 @@ menu_option_13() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_14() {
menu_option_15() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
@@ -442,13 +588,125 @@ menu_option_14() {
### Start the Build. ###
echo "Starting the build...."
packer build -force \
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_16() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build all Windows 11 Templates for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build all Windows 11 Templates for Proxmox. ###
echo "Building all Windows 11 Templates 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/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_17() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Windows 11 - Enterprise Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Windows 11 - Enterprise Template for Proxmox. ###
echo "Building a Windows 11 - Enterprise 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 \
--only proxmox-iso.windows-desktop-ent \
-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/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_18() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Windows 11 - Professional Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Windows 11 - Professional Templates for Proxmox. ###
echo "Building a Windows 11 - Professional 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 \
--only proxmox-iso.windows-desktop-pro \
-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/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
@@ -489,18 +747,22 @@ until [ "$selection" = "0" ]; do
echo ""
echo " 1 - AlmaLinux 9"
echo " 2 - AlmaLinux 8"
echo " 3 - CentOS 9 Stream"
echo " 4 - Debian 12"
echo " 5 - Debian 11"
echo " 6 - OpenSUSE Leap 15.6"
echo " 7 - OpenSUSE Leap 15.5"
echo " 8 - Oracle Linux 9"
echo " 9 - Oracle Linux 8"
echo " 10 - Rocky Linux 9"
echo " 11 - Rocky Linux 8"
echo " 12 - Ubuntu Server 24.04 LTS"
echo " 13 - Ubuntu Server 22.04 LTS"
echo " 14 - Ubuntu Server 20.04 LTS"
echo " 3 - CentOS 10 Stream"
echo " 4 - CentOS 9 Stream"
echo " 5 - Debian 12"
echo " 6 - Debian 11"
echo " 7 - OpenSUSE Leap 15.6"
echo " 8 - OpenSUSE Leap 15.5"
echo " 9 - Oracle Linux 9"
echo " 10 - Oracle Linux 8"
echo " 11 - Rocky Linux 9"
echo " 12 - Rocky Linux 8"
echo " 13 - Ubuntu Server 24.04 LTS"
echo " 14 - Ubuntu Server 22.04 LTS"
echo " 15 - Ubuntu Server 20.04 LTS"
echo " 16 - Windows 11 - All"
echo " 17 - Windows 11 - Enterprise Only"
echo " 18 - Windows 11 - Professional Only"
echo ""
echo " Other:"
echo ""
@@ -524,6 +786,10 @@ until [ "$selection" = "0" ]; do
12) clear ; menu_option_12 ; press_enter ;;
13) clear ; menu_option_13 ; press_enter ;;
14) clear ; menu_option_14 ; press_enter ;;
15) clear ; menu_option_15 ; press_enter ;;
16) clear ; menu_option_16 ; press_enter ;;
17) clear ; menu_option_17 ; press_enter ;;
18) clear ; menu_option_18 ; press_enter ;;
[Ii] ) clear ; info ; press_enter ;;
[Qq] ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;;

View File

@@ -6,7 +6,7 @@
*/
// Default Account Credentials
build_username = "ubuntu"
build_password = "ubuntu"
build_password_encrypted = "$6$Gg0b6uacy6apqKTP$OIvG1n8YUNpiDpsQgS02PgGgGY0egsYM0lqQq1lvOLKCAhMQcrY6SXq2K6ynt6RI8GVvmiagbKkcN6YXRzQtb1"
build_username = "deploy"
build_password = "deploy"
build_password_encrypted = "$6$MsfTs/5vjdnlgqEt$pkl1uGs645Y1NLpzQu7R/coOohkyzksn2YkY2EgjOuXkA6Tnrr3Yag8LYeotfYaiiyIzn3MyYCWdeqM.2VKAz1"
build_key = "Your public SSH key goes here"

View File

@@ -12,7 +12,8 @@ vm_storage_pool = "pool0"
// Boot and Provisioning Settings
common_data_source = "http"
common_http_ip = null
common_http_interface = null
common_http_bind_address = null
common_http_port_min = 8000
common_http_port_max = 8099
common_ip_wait_timeout = "20m"
@@ -20,3 +21,4 @@ common_shutdown_timeout = "15m"
// HCP Packer
common_hcp_packer_registry_enabled = false

View File

@@ -7,7 +7,7 @@
// The Packer configuration.
packer {
required_version = ">= 1.11.0"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
@@ -18,7 +18,7 @@ packer {
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.8"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-almalinux" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-almalinux" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-almalinux" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-almalinux" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,7 +7,7 @@
// The Packer configuration.
packer {
required_version = ">= 1.11.0"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
@@ -18,7 +18,7 @@ packer {
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.8"
version = ">= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-almalinux" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-almalinux" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-almalinux" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-almalinux" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -121,12 +121,14 @@ source "proxmox-iso" "linux-centos-stream" {
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 {
@@ -135,13 +137,11 @@ source "proxmox-iso" "linux-centos-stream" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -154,6 +154,7 @@ source "proxmox-iso" "linux-centos-stream" {
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
@@ -161,6 +162,12 @@ source "proxmox-iso" "linux-centos-stream" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -121,12 +121,14 @@ source "proxmox-iso" "linux-centos-stream" {
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 {
@@ -135,13 +137,11 @@ source "proxmox-iso" "linux-centos-stream" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -154,6 +154,7 @@ source "proxmox-iso" "linux-centos-stream" {
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
@@ -161,6 +162,12 @@ source "proxmox-iso" "linux-centos-stream" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -144,12 +144,14 @@ source "proxmox-iso" "debian" {
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 {
@@ -158,13 +160,11 @@ source "proxmox-iso" "debian" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -177,6 +177,7 @@ source "proxmox-iso" "debian" {
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
@@ -184,6 +185,12 @@ source "proxmox-iso" "debian" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -143,12 +143,14 @@ source "proxmox-iso" "debian" {
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 {
@@ -157,13 +159,11 @@ source "proxmox-iso" "debian" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -176,6 +176,7 @@ source "proxmox-iso" "debian" {
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
@@ -183,6 +184,12 @@ source "proxmox-iso" "debian" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -126,12 +126,14 @@ source "proxmox-iso" "linux-opensuse-leap" {
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 {
@@ -140,13 +142,11 @@ source "proxmox-iso" "linux-opensuse-leap" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -159,6 +159,7 @@ source "proxmox-iso" "linux-opensuse-leap" {
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
@@ -166,6 +167,12 @@ source "proxmox-iso" "linux-opensuse-leap" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -119,12 +119,14 @@ source "proxmox-iso" "linux-opensuse-leap" {
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 {
@@ -133,13 +135,11 @@ source "proxmox-iso" "linux-opensuse-leap" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -152,6 +152,7 @@ source "proxmox-iso" "linux-opensuse-leap" {
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
@@ -159,6 +160,12 @@ source "proxmox-iso" "linux-opensuse-leap" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,7 +7,7 @@
// The Packer configuration.
packer {
required_version = ">= 1.11.0"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
@@ -18,7 +18,7 @@ packer {
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.8"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-oracle" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-oracle" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-oracle" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-oracle" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,7 +7,7 @@
// The Packer configuration.
packer {
required_version = ">= 1.11.0"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
@@ -18,7 +18,7 @@ packer {
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.8"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-oracle" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-oracle" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-oracle" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-oracle" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-rocky" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-rocky" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-rocky" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-rocky" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -122,12 +122,14 @@ source "proxmox-iso" "linux-rocky" {
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 {
@@ -136,13 +138,11 @@ source "proxmox-iso" "linux-rocky" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -155,6 +155,7 @@ source "proxmox-iso" "linux-rocky" {
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
@@ -162,6 +163,12 @@ source "proxmox-iso" "linux-rocky" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -129,12 +129,14 @@ source "proxmox-iso" "ubuntu" {
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 {
@@ -143,13 +145,11 @@ source "proxmox-iso" "ubuntu" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -162,6 +162,7 @@ source "proxmox-iso" "ubuntu" {
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
@@ -169,6 +170,12 @@ source "proxmox-iso" "ubuntu" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -125,12 +125,14 @@ source "proxmox-iso" "ubuntu" {
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 {
@@ -139,13 +141,11 @@ source "proxmox-iso" "ubuntu" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -158,6 +158,7 @@ source "proxmox-iso" "ubuntu" {
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
@@ -165,6 +166,12 @@ source "proxmox-iso" "ubuntu" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -7,18 +7,18 @@
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
version = ">= 0.6.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.0.6"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -125,12 +125,14 @@ source "proxmox-iso" "ubuntu" {
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 {
@@ -139,13 +141,11 @@ source "proxmox-iso" "ubuntu" {
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
@@ -158,6 +158,7 @@ source "proxmox-iso" "ubuntu" {
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
@@ -165,6 +166,12 @@ source "proxmox-iso" "ubuntu" {
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 {

View File

@@ -215,6 +215,12 @@ variable "common_http_bind_address" {
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."

View File

@@ -5,11 +5,10 @@
*/
// Proxmox Credentials
proxmox_api_url = "<FQDN or IP of proxmox server>"
proxmox_api_token_id = "name@realm!token"
proxmox_api_token_secret = "<token secret>"
proxmox_insecure_connection = false
// Proxmox Settings
// Proxmox Specific Settings
proxmox_hostname = "<FQDN or IP of proxmox server>"
proxmox_node = "<proxmox node name>"
proxmox_hostname = "<proxmox hostname>"

View File

@@ -114,19 +114,16 @@ variable "vm_os_name" {
variable "vm_os_version" {
type = string
description = "The guest operating system version. Used for naming."
default = "11"
}
variable "vm_os_edition_pro" {
type = string
description = "The guest operating system edition. Used for naming."
default = "pro"
}
variable "vm_os_edition_ent" {
type = string
description = "The guest operating system edition. Used for naming."
default = "ent"
}
variable "vm_os_type" {
@@ -297,6 +294,12 @@ variable "common_http_bind_address" {
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."
@@ -307,10 +310,10 @@ variable "common_http_port_max" {
description = "The end of the HTTP port range."
}
// variable "vm_boot_order" {
// type = string
// description = "The boot order for virtual machines devices."
// }
variable "vm_boot_order" {
type = string
description = "The boot order for virtual machines devices."
}
variable "vm_boot_wait" {
type = string

View File

@@ -8,7 +8,7 @@
// The Packer configuration.
packer {
required_version = ">= 1.11.0"
required_version = ">= 1.12.0"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
@@ -19,7 +19,7 @@ packer {
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.2.2"
version = "= 1.2.1"
source = "github.com/hashicorp/proxmox"
}
}
@@ -125,11 +125,11 @@ source "proxmox-iso" "windows-desktop-pro" {
"autounattend.xml" = templatefile("${abspath(path.root)}/data/autounattend.pkrtpl.hcl", {
build_username = var.build_username
build_password = var.build_password
vm_inst_os_eval = var.vm_inst_os_eval // Does not support evaluation.
vm_inst_os_eval = var.vm_inst_os_eval
vm_inst_os_language = var.vm_inst_os_language
vm_inst_os_keyboard = var.vm_inst_os_keyboard
vm_inst_os_image = var.vm_inst_os_image_pro
vm_inst_os_key = var.vm_inst_os_key_pro // Does not support evaluation.
vm_inst_os_key = var.vm_inst_os_key_pro
vm_guest_os_language = var.vm_os_language
vm_guest_os_keyboard = var.vm_os_keyboard
vm_guest_os_timezone = var.vm_os_timezone
@@ -141,6 +141,8 @@ source "proxmox-iso" "windows-desktop-pro" {
}
// Boot and Provisioning Settings
http_interface = var.common_http_interface
http_bind_address = var.common_http_bind_address
http_port_min = var.common_http_port_min
http_port_max = var.common_http_port_max
boot_wait = var.vm_boot_wait
@@ -235,11 +237,11 @@ source "proxmox-iso" "windows-desktop-ent" {
"autounattend.xml" = templatefile("${abspath(path.root)}/data/autounattend.pkrtpl.hcl", {
build_username = var.build_username
build_password = var.build_password
vm_inst_os_eval = var.vm_inst_os_eval // Does not support evaluation.
vm_inst_os_eval = var.vm_inst_os_eval
vm_inst_os_language = var.vm_inst_os_language
vm_inst_os_keyboard = var.vm_inst_os_keyboard
vm_inst_os_image = var.vm_inst_os_image_ent
vm_inst_os_key = var.vm_inst_os_key_ent // Does not support evaluation.
vm_inst_os_key = var.vm_inst_os_key_ent
vm_guest_os_language = var.vm_os_language
vm_guest_os_keyboard = var.vm_os_keyboard
vm_guest_os_timezone = var.vm_os_timezone
@@ -251,6 +253,8 @@ source "proxmox-iso" "windows-desktop-ent" {
}
// Boot and Provisioning Settings
http_interface = var.common_http_interface
http_bind_address = var.common_http_bind_address
http_port_min = var.common_http_port_min
http_port_max = var.common_http_port_max
boot_wait = var.vm_boot_wait
@@ -272,7 +276,8 @@ source "proxmox-iso" "windows-desktop-ent" {
build {
sources = [
"source.proxmox-iso.windows-desktop-ent"
"source.proxmox-iso.windows-desktop-pro",
"source.proxmox-iso.windows-desktop-ent",
]
provisioner "ansible" {

View File

@@ -5,16 +5,20 @@
*/
// Installation Operating System Metadata
vm_inst_os_eval = true
vm_inst_os_language = "en-US"
vm_inst_os_keyboard = "en-US"
vm_inst_os_image_pro = "Windows 11 Pro"
vm_inst_os_key_pro = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
vm_inst_os_image_ent = "Windows 11 Enterprise Evaluation"
vm_inst_os_key_ent = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
// Virtual Machine Guest Operating System Setting
vm_guest_os_type = "windows9_64Guest"
// Virtual Machine Hardware Settings
vm_firmware = "efi-secure"
// Removable Media Settings
iso_datastore_path = "iso/windows/windows-desktop/11/amd64"
iso_content_library_item = "22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us"
iso_file = "22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
// Guest Operating System Metadata
vm_os_language = "en-US"
vm_os_keyboard = "en-US"
vm_os_timezone = "UTC"
vm_os_family = "windows"
vm_os_name = "desktop"
vm_os_version = "11"
vm_os_edition_pro = "pro"
vm_os_edition_ent = "ent"

View File

@@ -7,24 +7,31 @@ source common.sh
SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=${1:-${SCRIPT_PATH}/config}
mkdir -p "$CONFIG_PATH"
# Define the script and config paths
follow_link_result=$(follow_link "$0")
if ! SCRIPT_PATH=$(realpath "$(dirname "${follow_link_result}")"); then
echo "Error: follow_link or realpath failed"
exit 1
fi
CONFIG_PATH=${1:-${SCRIPT_PATH}/config}
mkdir -p "${CONFIG_PATH}"
### Copy the example input variables.
echo
echo "> Copying the example input variables..."
cp -av "$SCRIPT_PATH"/builds/*.pkrvars.hcl.example "$CONFIG_PATH"
cp -av "${SCRIPT_PATH}"/builds/*.pkrvars.hcl.example "${CONFIG_PATH}"
find "${SCRIPT_PATH}"/builds/*/ -type f -name "*.pkrvars.hcl.example" | while IFS= read -r srcfile; do
srcdir=$(dirname "${srcfile}" | tr -s /)
dstfile=$(echo "${srcdir#"${SCRIPT_PATH}"/builds/}" | tr '/' '-')
cp -av "${srcfile}" "${CONFIG_PATH}/${dstfile}.pkrvars.hcl.example"
done
### Rename the example input variables.
echo
echo "> Renaming the example input variables..."
srcext=".pkrvars.hcl.example"
dstext=".pkrvars.hcl"
for f in "$CONFIG_PATH"/*"${srcext}"; do
bname="${f%"${srcext}"}"
echo "${bname}{${srcext}${dstext}}"
mv "${f}" "${bname}${dstext}"
for file in "${CONFIG_PATH}"/*.pkrvars.hcl.example; do
mv -- "${file}" "${file%.example}"
done
echo
echo "> Done."

View File

@@ -5,7 +5,7 @@
$ErrorActionPreference = 'Stop'
# Set network connections provile to Private mode.
# Set network connections profile to Private mode.
Write-Output 'Setting the network connection profiles to Private...'
$connectionProfile = Get-NetConnectionProfile
While ($connectionProfile.Name -eq 'Identifying...') {

101
validate.sh Executable file
View File

@@ -0,0 +1,101 @@
#!/usr/bin/env bash
set -e
# Load common functions
source common.sh
# === Colors ===
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
BLUE="\033[0;34m"
NC="\033[0m"
# === Paths ===
SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}")
INPUT_PATHS=(
"$SCRIPT_PATH/builds/linux/almalinux/9/"
"$SCRIPT_PATH/builds/linux/almalinux/8/"
"$SCRIPT_PATH/builds/linux/centos/10-stream/"
"$SCRIPT_PATH/builds/linux/centos/9-stream/"
"$SCRIPT_PATH/builds/linux/debian/12/"
"$SCRIPT_PATH/builds/linux/debian/11/"
"$SCRIPT_PATH/builds/linux/opensuse/leap-15-6/"
"$SCRIPT_PATH/builds/linux/opensuse/leap-15-5/"
"$SCRIPT_PATH/builds/linux/oracle/9/"
"$SCRIPT_PATH/builds/linux/oracle/8/"
"$SCRIPT_PATH/builds/linux/rocky/9/"
"$SCRIPT_PATH/builds/linux/rocky/8/"
"$SCRIPT_PATH/builds/linux/ubuntu/24-04-lts/"
"$SCRIPT_PATH/builds/linux/ubuntu/22-04-lts/"
"$SCRIPT_PATH/builds/linux/ubuntu/20-04-lts/"
"$SCRIPT_PATH/builds/windows/desktop/11/"
)
# === Result storage ===
declare -a summary=()
# === Validation Function ===
validate_packer() {
local input_path="$1"
local current_build_path current_build_vars os version
version=$(basename "$input_path")
os=$(basename "$(dirname "$input_path")")
echo -e "${BLUE}▶ Validating: ${YELLOW}${os^^} ${version}${NC}"
if echo "$input_path" | grep -qi "windows"; then
current_build_path=${input_path#"${SCRIPT_PATH}/builds/"}
current_build_vars="$(echo "${current_build_path%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
VAR_FILES=(
"$CONFIG_PATH/ansible.pkrvars.hcl"
"$CONFIG_PATH/build.pkrvars.hcl"
"$CONFIG_PATH/common.pkrvars.hcl"
"$CONFIG_PATH/network.pkrvars.hcl"
"$CONFIG_PATH/proxmox.pkrvars.hcl"
"$CONFIG_PATH/proxy.pkrvars.hcl"
"$CONFIG_PATH/$current_build_vars"
)
else
VAR_FILES=(
"$CONFIG_PATH/ansible.pkrvars.hcl"
"$CONFIG_PATH/build.pkrvars.hcl"
"$CONFIG_PATH/common.pkrvars.hcl"
"$CONFIG_PATH/linux-storage.pkrvars.hcl"
"$CONFIG_PATH/network.pkrvars.hcl"
"$CONFIG_PATH/proxmox.pkrvars.hcl"
"$CONFIG_PATH/proxy.pkrvars.hcl"
)
fi
if packer_output=$(packer validate "${VAR_FILES[@]/#/--var-file=}" "$input_path" 2>&1); then
echo -e " ${GREEN}✔ PASS${NC}"
summary+=("${os}/${version} : PASS")
else
echo -e " ${RED}✘ FAIL${NC}"
echo "$packer_output"
summary+=("${os}/${version} : FAIL")
fi
echo -e "${NC}----------------------------------------"
}
# === Main Execution ===
echo -e "${BLUE}==> Starting Packer validations...${NC}"
for path in "${INPUT_PATHS[@]}"; do
validate_packer "$path"
done
# === Summary Output ===
echo -e "\n${BLUE}==> Validation Summary:${NC}"
for entry in "${summary[@]}"; do
if [[ "$entry" == *FAIL ]]; then
echo -e "${RED}$entry${NC}"
else
echo -e "${GREEN}$entry${NC}"
fi
done