Merge pull request #7 from ajschroeder/develop
feat: Major updates to vars, added builds, added validator script, updated docs
This commit is contained in:
28
.devcontainer/Dockerfile
Normal file
28
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# Use the base Ubuntu devcontainer image.
|
||||
FROM mcr.microsoft.com/devcontainers/base:ubuntu
|
||||
|
||||
# Install additional packages.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl software-properties-common ca-certificates
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
# Install Packer
|
||||
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings/ && \
|
||||
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/hashicorp-packer.gpg && \
|
||||
sudo echo "deb [arch=amd64, signed-by=/etc/apt/keyrings/hashicorp-packer.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp-packer.list > /dev/null && \
|
||||
sudo chmod 0644 /etc/apt/keyrings/hashicorp-packer.gpg && \
|
||||
sudo apt-get update && sudo apt-get install packer
|
||||
|
||||
# Install Python3 and Ansible.
|
||||
RUN add-apt-repository --yes --update ppa:ansible/ansible && \
|
||||
apt-get update && \
|
||||
apt-get install -y python3 python3-pip ansible
|
||||
|
||||
# Cleanup.
|
||||
RUN apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set PATH
|
||||
ENV PATH="$HOME/.local/bin:$PATH"
|
||||
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Packer Examples for Proxmox",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"features": {},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"GitHub.vscode-pull-request-github",
|
||||
"hashicorp.hcl",
|
||||
"redhat.ansible"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,22 +1,31 @@
|
||||
# Ansible and ansible-lint
|
||||
**/.ansible
|
||||
|
||||
!**/template_*
|
||||
**/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
|
||||
|
||||
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"hashicorp.hcl", // HCL
|
||||
"redhat.ansible", // Ansible
|
||||
"vscode.json-language-features" // JSON
|
||||
]
|
||||
}
|
||||
27
.vscode/settings.json
vendored
Normal file
27
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
// Ansible settings
|
||||
"ansible.python.interpreterPath": "/usr/bin/python3",
|
||||
// Editor settings
|
||||
"editor.bracketPairColorization.enabled": true,
|
||||
"editor.bracketPairColorization.independentColorPoolPerBracketType": true,
|
||||
"editor.formatOnSaveMode": "modificationsIfAvailable",
|
||||
"editor.guides.bracketPairs": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
// File watcher settings
|
||||
"files.watcherExclude": {
|
||||
"**/.DS_Store": true,
|
||||
"**/.site/**": true,
|
||||
"**/.trunk/**": true
|
||||
},
|
||||
// Extension settings
|
||||
"extensions.ignoreRecommendations": false,
|
||||
// Language-specific settings
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "vscode.json-language-features",
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"editor.trimAutoWhitespace": true
|
||||
},
|
||||
}
|
||||
92
README.md
92
README.md
@@ -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:
|
||||
@@ -315,12 +317,13 @@ Edit the `config/common.pkrvars.hcl` file to configure the following common vari
|
||||
common_iso_storage = "<Proxmox Storage Location>"
|
||||
|
||||
// Boot and Provisioning Settings
|
||||
common_data_source = "http"
|
||||
common_http_ip = null
|
||||
common_http_port_min = 8000
|
||||
common_http_port_max = 8099
|
||||
common_ip_wait_timeout = "20m"
|
||||
common_shutdown_timeout = "15m"
|
||||
common_data_source = "http"
|
||||
common_http_interface = null
|
||||
common_http_bind_address = null
|
||||
common_http_port_min = 8000
|
||||
common_http_port_max = 8099
|
||||
common_ip_wait_timeout = "20m"
|
||||
common_shutdown_timeout = "15m"
|
||||
|
||||
// HCP Packer
|
||||
common_hcp_packer_registry_enabled = false
|
||||
@@ -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,13 +418,13 @@ 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_node = "<proxmox node name>"
|
||||
// Proxmox Specific Settings
|
||||
proxmox_hostname = "<FQDN or IP of proxmox server>"
|
||||
proxmox_node = "<proxmox node name>"
|
||||
```
|
||||
|
||||
The `proxmox_api_token_id` variable uses a specific format and, as the time of this writing, needs to be assigned to the `PVEAdmin` role. One of the to-do's is to document a least-privilege method of creating the Proxmox API token.
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
---
|
||||
enable_cloudinit: false
|
||||
|
||||
base_chocolatey_packages:
|
||||
- firefox
|
||||
- putty
|
||||
|
||||
@@ -20,4 +20,6 @@
|
||||
include_tasks: suse.yml
|
||||
when: "ansible_facts['distribution'] in ['openSUSE Leap', 'Suse']"
|
||||
|
||||
...
|
||||
- name: "{{ base_task_name }}"
|
||||
ansible.builtin.include_tasks: windows.yml
|
||||
when: ansible_os_family == "Windows"
|
||||
|
||||
18
ansible/roles/base/tasks/windows.yml
Normal file
18
ansible/roles/base/tasks/windows.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# Microsoft Windows specific tasks.
|
||||
|
||||
# Tasks for updating the operating system and installing additional packages.
|
||||
- name: Getting guest operating system information
|
||||
ansible.builtin.debug:
|
||||
msg: "OS: {{ ansible_os_name }}"
|
||||
|
||||
- name: Install latest version of Chocolatey
|
||||
chocolatey.chocolatey.win_chocolatey:
|
||||
name: chocolatey
|
||||
state: latest
|
||||
|
||||
- name: Installing additional packages using Chocolatey
|
||||
chocolatey.chocolatey.win_chocolatey:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
loop: "{{ base_chocolatey_packages }}"
|
||||
@@ -16,4 +16,6 @@
|
||||
include_tasks: suse.yml
|
||||
when: "ansible_facts['distribution'] in ['openSUSE Leap', 'Suse']"
|
||||
|
||||
...
|
||||
- name: "{{ configure_task_name }}"
|
||||
ansible.builtin.include_tasks: windows.yml
|
||||
when: ansible_os_family == "Windows"
|
||||
|
||||
133
ansible/roles/configure/tasks/windows.yml
Normal file
133
ansible/roles/configure/tasks/windows.yml
Normal file
@@ -0,0 +1,133 @@
|
||||
---
|
||||
# Microsoft Windows specific tasks.
|
||||
|
||||
# Set the Windows Explorer options.
|
||||
# ansible-lint: disable=line-length
|
||||
- name: Setting the Windows Explorer options...
|
||||
when: ansible_os_installation_type != "Server Core"
|
||||
block:
|
||||
- name: Show hidden files.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
|
||||
name: Hidden
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
- name: Show file extensions.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
|
||||
name: HideFileExt
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Show drives with no media.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
|
||||
name: HideDrivesWithNoMedia
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Disabling Sync Provider Notifications.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
|
||||
name: ShowSyncProviderNotifications
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
# Disable system hibernation.
|
||||
- name: Disabling System Hibernation...
|
||||
block:
|
||||
- name: Disabling Hibernation.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\Power
|
||||
name: HibernateEnabled
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Setting HiberFileSizePercent to 0.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\Power
|
||||
name: HiberFileSizePercent
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
# Disable TLS 1.0.s
|
||||
- name: Disabling TLS 1.0 for Client...
|
||||
block:
|
||||
- name: Disabling TLS 1.0 for Client.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client
|
||||
name: Enabled
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Setting TLS 1.0 for Client to Disabled by Default.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client
|
||||
name: DisabledByDefault
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
- name: Disabling TLS 1.0 for Server.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server
|
||||
name: Enabled
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Setting TLS 1.0 for Server to Disabled by Default.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server
|
||||
name: DisabledByDefault
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
# Disable TLS 1.1.
|
||||
- name: Disabling TLS 1.1 for Client...
|
||||
block:
|
||||
- name: Disabling TLS 1.1 for Client.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client
|
||||
name: Enabled
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Setting TLS 1.1 for Client to Disabled by Default.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client
|
||||
name: DisabledByDefault
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
- name: Disabling TLS 1.1 for Server.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server
|
||||
name: Enabled
|
||||
data: 0
|
||||
type: dword
|
||||
|
||||
- name: Setting TLS 1.1 for Server to Disabled by Default.
|
||||
ansible.windows.win_regedit:
|
||||
path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server
|
||||
name: DisabledByDefault
|
||||
data: 1
|
||||
type: dword
|
||||
|
||||
# Disable Password Expiration for Administrator and Build Accounts
|
||||
- name: Disabling Local Administrator Password Expiration...
|
||||
ansible.windows.win_user:
|
||||
name: Administrator
|
||||
password_never_expires: true
|
||||
|
||||
- name: Disabling Password Expiration for "{{ build_username }}"
|
||||
ansible.windows.win_user:
|
||||
name: "{{ build_username }}"
|
||||
password_never_expires: true
|
||||
|
||||
# Enable Remote Desktop.
|
||||
- name: Enabling Remote Desktop...
|
||||
ansible.windows.win_powershell:
|
||||
script: |
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0 | Out-Null
|
||||
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 0
|
||||
Enable-NetFirewallRule -Group '@FirewallAPI.dll,-28752'
|
||||
8
ansible/windows-playbook.yml
Normal file
8
ansible/windows-playbook.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Playbook for Microsoft Windows
|
||||
debugger: never
|
||||
gather_facts: true
|
||||
hosts: all
|
||||
roles:
|
||||
- base
|
||||
- configure
|
||||
8
ansible/windows-requirements.yml
Normal file
8
ansible/windows-requirements.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
collections:
|
||||
- name: ansible.windows
|
||||
version: 2.3.0
|
||||
- name: chocolatey.chocolatey
|
||||
version: 1.5.1
|
||||
- name: community.general
|
||||
version: 8.6.0
|
||||
342
build.sh
342
build.sh
@@ -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 ;;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -11,12 +11,14 @@ common_iso_storage = "OS"
|
||||
vm_storage_pool = "pool0"
|
||||
|
||||
// Boot and Provisioning Settings
|
||||
common_data_source = "http"
|
||||
common_http_ip = null
|
||||
common_http_port_min = 8000
|
||||
common_http_port_max = 8099
|
||||
common_ip_wait_timeout = "20m"
|
||||
common_shutdown_timeout = "15m"
|
||||
common_data_source = "http"
|
||||
common_http_interface = null
|
||||
common_http_bind_address = null
|
||||
common_http_port_min = 8000
|
||||
common_http_port_max = 8099
|
||||
common_ip_wait_timeout = "20m"
|
||||
common_shutdown_timeout = "15m"
|
||||
|
||||
// HCP Packer
|
||||
common_hcp_packer_registry_enabled = false
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
- Use a size value of -1 to use all remaining space on disk.
|
||||
*/
|
||||
|
||||
/*
|
||||
// This section is an example when you want to build a VM with the BIOS bootloader
|
||||
// using a single partition that consumes the entire VM disk.
|
||||
|
||||
@@ -35,6 +36,7 @@ vm_disk_partitions = [
|
||||
volume_group = "",
|
||||
},
|
||||
]
|
||||
*/
|
||||
|
||||
/*
|
||||
// This section is an example when you want to build a VM with the UEFI bootloader
|
||||
@@ -244,7 +246,6 @@ vm_disk_lvm = [
|
||||
]
|
||||
*/
|
||||
|
||||
/*
|
||||
// This section is an example when you want to build a VM with the EFI firmware
|
||||
// using LVM with a volume layout that follows CIS hardening guidelines.
|
||||
|
||||
@@ -415,4 +416,3 @@ vm_disk_lvm = [
|
||||
],
|
||||
}
|
||||
]
|
||||
*/
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
82
builds/linux/centos/10-stream/data/ks.pkrtpl.hcl
Normal file
82
builds/linux/centos/10-stream/data/ks.pkrtpl.hcl
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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.
|
||||
|
||||
# CentOS Stream 9
|
||||
|
||||
### 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 SSDD 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
|
||||
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
|
||||
5
builds/linux/centos/10-stream/data/network.pkrtpl.hcl
Normal file
5
builds/linux/centos/10-stream/data/network.pkrtpl.hcl
Normal 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 ~}
|
||||
73
builds/linux/centos/10-stream/data/storage.pkrtpl.hcl
Normal file
73
builds/linux/centos/10-stream/data/storage.pkrtpl.hcl
Normal 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 ~}
|
||||
233
builds/linux/centos/10-stream/linux-centos-stream.pkr.hcl
Normal file
233
builds/linux/centos/10-stream/linux-centos-stream.pkr.hcl
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CentOS Stream 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
|
||||
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-centos-stream" {
|
||||
|
||||
// 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-centos-stream"]
|
||||
|
||||
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}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CentOS Stream 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 = "centos-stream"
|
||||
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-v4"
|
||||
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 = "CentOS-Stream-10-latest-x86_64-dvd1.iso"
|
||||
iso_checksum = "file:https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/iso/SHA256SUM"
|
||||
|
||||
// Boot Settings
|
||||
vm_boot = "order=virtio0;ide2;net0"
|
||||
vm_boot_wait = "5s"
|
||||
|
||||
// EFI Settings
|
||||
vm_firmware_path = "./OVMF.fd"
|
||||
36
builds/linux/centos/10-stream/variables-network.pkr.hcl
Normal file
36
builds/linux/centos/10-stream/variables-network.pkr.hcl
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CentOS Stream 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 = []
|
||||
}
|
||||
53
builds/linux/centos/10-stream/variables-storage.pkr.hcl
Normal file
53
builds/linux/centos/10-stream/variables-storage.pkr.hcl
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CentOS Stream 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 = []
|
||||
}
|
||||
313
builds/linux/centos/10-stream/variables.pkr.hcl
Normal file
313
builds/linux/centos/10-stream/variables.pkr.hcl
Normal file
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CentOS 10 Stream 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 = []
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -5,10 +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_node = "<proxmox node name>"
|
||||
// Proxmox Specific Settings
|
||||
proxmox_hostname = "<FQDN or IP of proxmox server>"
|
||||
proxmox_node = "<proxmox node name>"
|
||||
|
||||
11
builds/proxy.pkrvars.hcl.example
Normal file
11
builds/proxy.pkrvars.hcl.example
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
Proxy variables used for Linux builds. (Optional)
|
||||
- Variables are passed to and used by configuration scripts.
|
||||
*/
|
||||
|
||||
// Proxy Credentials
|
||||
// communicator_proxy_host = "proxy.example.com"
|
||||
// communicator_proxy_port = 3128
|
||||
// communicator_proxy_username = "packer_proxy"
|
||||
// communicator_proxy_password = "Sup3rdup3rSecr3t!"
|
||||
220
builds/windows/desktop/11/data/autounattend.pkrtpl.hcl
Normal file
220
builds/windows/desktop/11/data/autounattend.pkrtpl.hcl
Normal file
@@ -0,0 +1,220 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<settings pass="windowsPE">
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<SetupUILanguage>
|
||||
<UILanguage>${vm_inst_os_language}</UILanguage>
|
||||
</SetupUILanguage>
|
||||
<InputLocale>${vm_inst_os_keyboard}</InputLocale>
|
||||
<SystemLocale>${vm_inst_os_language}</SystemLocale>
|
||||
<UILanguage>${vm_inst_os_language}</UILanguage>
|
||||
<UILanguageFallback>${vm_inst_os_language}</UILanguageFallback>
|
||||
<UserLocale>${vm_inst_os_language}</UserLocale>
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<DriverPaths>
|
||||
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
|
||||
<Path>F:\viostor\w11\amd64\</Path>
|
||||
</PathAndCredentials>
|
||||
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
|
||||
<Path>F:\NetKVM\w11\amd64\</Path>
|
||||
</PathAndCredentials>
|
||||
</DriverPaths>
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<DiskConfiguration>
|
||||
<Disk wcm:action="add">
|
||||
<DiskID>0</DiskID>
|
||||
<WillWipeDisk>true</WillWipeDisk>
|
||||
<CreatePartitions>
|
||||
<!-- Windows RE Tools partition -->
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<Type>Primary</Type>
|
||||
<Size>550</Size>
|
||||
</CreatePartition>
|
||||
<!-- System partition (ESP) -->
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<Type>EFI</Type>
|
||||
<Size>100</Size>
|
||||
</CreatePartition>
|
||||
<!-- Microsoft reserved partition (MSR) -->
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>3</Order>
|
||||
<Type>MSR</Type>
|
||||
<Size>128</Size>
|
||||
</CreatePartition>
|
||||
<!-- Windows partition -->
|
||||
<CreatePartition wcm:action="add">
|
||||
<Order>4</Order>
|
||||
<Type>Primary</Type>
|
||||
<Extend>true</Extend>
|
||||
</CreatePartition>
|
||||
</CreatePartitions>
|
||||
<ModifyPartitions>
|
||||
<!-- Windows RE Tools partition -->
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>1</Order>
|
||||
<PartitionID>1</PartitionID>
|
||||
<Label>WINRE</Label>
|
||||
<Format>NTFS</Format>
|
||||
<TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
|
||||
</ModifyPartition>
|
||||
<!-- System partition (ESP) -->
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>2</Order>
|
||||
<PartitionID>2</PartitionID>
|
||||
<Label>System</Label>
|
||||
<Format>FAT32</Format>
|
||||
</ModifyPartition>
|
||||
<!-- MSR partition does not need to be modified -->
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>3</Order>
|
||||
<PartitionID>3</PartitionID>
|
||||
</ModifyPartition>
|
||||
<!-- Windows partition -->
|
||||
<ModifyPartition wcm:action="add">
|
||||
<Order>4</Order>
|
||||
<PartitionID>4</PartitionID>
|
||||
<Label>OS</Label>
|
||||
<Letter>C</Letter>
|
||||
<Format>NTFS</Format>
|
||||
</ModifyPartition>
|
||||
</ModifyPartitions>
|
||||
</Disk>
|
||||
</DiskConfiguration>
|
||||
<ImageInstall>
|
||||
<OSImage>
|
||||
<InstallFrom>
|
||||
<MetaData wcm:action="add">
|
||||
<Key>/IMAGE/NAME</Key>
|
||||
<Value>${vm_inst_os_image}</Value>
|
||||
</MetaData>
|
||||
</InstallFrom>
|
||||
<InstallTo>
|
||||
<DiskID>0</DiskID>
|
||||
<PartitionID>4</PartitionID>
|
||||
</InstallTo>
|
||||
</OSImage>
|
||||
</ImageInstall>
|
||||
<RunSynchronous>
|
||||
<RunSynchronousCommand>
|
||||
<Order>1</Order>
|
||||
<!-- Set power scheme to high performance in WinPE for faster imaging. -->
|
||||
<Path>cmd /c powercfg.exe /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c</Path>
|
||||
</RunSynchronousCommand>
|
||||
</RunSynchronous>
|
||||
<UserData>
|
||||
<AcceptEula>true</AcceptEula>
|
||||
<FullName>${build_username}</FullName>
|
||||
<Organization>${build_username}</Organization>
|
||||
%{if vm_inst_os_eval != true ~}
|
||||
<ProductKey>
|
||||
<Key>${vm_inst_os_key}</Key>
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
</ProductKey>
|
||||
%{ endif ~}
|
||||
</UserData>
|
||||
<EnableFirewall>false</EnableFirewall>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="offlineServicing">
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<EnableLUA>false</EnableLUA>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="generalize">
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<SkipRearm>1</SkipRearm>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="specialize">
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<OEMInformation>
|
||||
<HelpCustomized>false</HelpCustomized>
|
||||
</OEMInformation>
|
||||
<TimeZone>${vm_guest_os_timezone}</TimeZone>
|
||||
<RegisteredOwner />
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<SkipAutoActivation>true</SkipAutoActivation>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="oobeSystem">
|
||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<InputLocale>${vm_guest_os_keyboard}</InputLocale>
|
||||
<SystemLocale>${vm_guest_os_language}</SystemLocale>
|
||||
<UILanguage>${vm_guest_os_language}</UILanguage>
|
||||
<UILanguageFallback>${vm_guest_os_language}</UILanguageFallback>
|
||||
<UserLocale>${vm_guest_os_language}</UserLocale>
|
||||
</component>
|
||||
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
|
||||
<AutoLogon>
|
||||
<Password>
|
||||
<Value>${build_password}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
<Enabled>true</Enabled>
|
||||
<Username>${build_username}</Username>
|
||||
</AutoLogon>
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
|
||||
<NetworkLocation>Work</NetworkLocation>
|
||||
<ProtectYourPC>2</ProtectYourPC>
|
||||
</OOBE>
|
||||
<UserAccounts>
|
||||
<AdministratorPassword>
|
||||
<Value>${build_password}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</AdministratorPassword>
|
||||
<LocalAccounts>
|
||||
<LocalAccount wcm:action="add">
|
||||
<Password>
|
||||
<Value>${build_password}</Value>
|
||||
<PlainText>true</PlainText>
|
||||
</Password>
|
||||
<Group>administrators</Group>
|
||||
<DisplayName>${build_username}</DisplayName>
|
||||
<Name>${build_username}</Name>
|
||||
<Description>Build Account</Description>
|
||||
</LocalAccount>
|
||||
</LocalAccounts>
|
||||
</UserAccounts>
|
||||
<FirstLogonCommands>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
|
||||
<Description>Set Execution Policy 64-Bit</Description>
|
||||
<Order>1</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
|
||||
<Description>Set Execution Policy 32-Bit</Description>
|
||||
<Order>2</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File E:\windows-virtio.ps1</CommandLine>
|
||||
<Order>3</Order>
|
||||
<Description>Install VMware Tools</Description>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File E:\windows-init.ps1</CommandLine>
|
||||
<Order>4</Order>
|
||||
<Description>Initial Configuration</Description>
|
||||
</SynchronousCommand>
|
||||
</FirstLogonCommands>
|
||||
</component>
|
||||
</settings>
|
||||
</unattend>
|
||||
416
builds/windows/desktop/11/variables.pkr.hcl
Normal file
416
builds/windows/desktop/11/variables.pkr.hcl
Normal file
@@ -0,0 +1,416 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
Microsoft Windows 11 input variables.
|
||||
Packer Plugin for Proxmox: 'proxmox-iso' builder.
|
||||
*/
|
||||
|
||||
// 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."
|
||||
}
|
||||
|
||||
// Installer Settings
|
||||
|
||||
variable "vm_inst_os_language" {
|
||||
type = string
|
||||
description = "The installation operating system lanugage."
|
||||
default = "en-US"
|
||||
}
|
||||
|
||||
variable "vm_inst_os_keyboard" {
|
||||
type = string
|
||||
description = "The installation operating system keyboard input."
|
||||
default = "en-US"
|
||||
}
|
||||
|
||||
variable "vm_inst_os_eval" {
|
||||
type = bool
|
||||
description = "Build using the operating system evaluation"
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "vm_inst_os_image_pro" {
|
||||
type = string
|
||||
description = "The installation operating system image input.\nDoes not support evaluation."
|
||||
default = "Windows 11 Pro"
|
||||
}
|
||||
|
||||
variable "vm_inst_os_image_ent" {
|
||||
type = string
|
||||
description = "The installation operating system image input. Does support evaluation."
|
||||
default = "Windows 11 Enterprise"
|
||||
}
|
||||
|
||||
variable "vm_inst_os_key_pro" {
|
||||
type = string
|
||||
description = "The installation operating system key input."
|
||||
}
|
||||
variable "vm_inst_os_key_ent" {
|
||||
type = string
|
||||
description = "The installation operating system key input."
|
||||
}
|
||||
|
||||
// Virtual Machine Settings
|
||||
|
||||
variable "vm_os_language" {
|
||||
type = string
|
||||
description = "The guest operating system lanugage."
|
||||
default = "en-US"
|
||||
}
|
||||
|
||||
variable "vm_os_keyboard" {
|
||||
type = string
|
||||
description = "The guest operating system keyboard input."
|
||||
default = "en-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')"
|
||||
default = "windows"
|
||||
}
|
||||
|
||||
variable "vm_os_name" {
|
||||
type = string
|
||||
description = "The guest operating system name. Used for naming."
|
||||
default = "desktop"
|
||||
}
|
||||
|
||||
variable "vm_os_version" {
|
||||
type = string
|
||||
description = "The guest operating system version. Used for naming."
|
||||
}
|
||||
|
||||
variable "vm_os_edition_pro" {
|
||||
type = string
|
||||
description = "The guest operating system edition. Used for naming."
|
||||
}
|
||||
|
||||
variable "vm_os_edition_ent" {
|
||||
type = string
|
||||
description = "The guest operating system edition. Used for naming."
|
||||
}
|
||||
|
||||
variable "vm_os_type" {
|
||||
type = string
|
||||
description = "The guest operating system type, also know as guestid."
|
||||
}
|
||||
|
||||
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')"
|
||||
default = "local"
|
||||
}
|
||||
|
||||
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_machine_type" {
|
||||
type = string
|
||||
description = "Set the machine type. Supported values are 'pc' or 'q35'."
|
||||
default = "pc"
|
||||
validation {
|
||||
condition = contains(["pc", "q35"], var.vm_machine_type)
|
||||
error_message = "The vm_machine_type value must be 'pc' or 'q35'."
|
||||
}
|
||||
}
|
||||
variable "vm_cpu_count" {
|
||||
type = number
|
||||
description = "The number of virtual CPUs."
|
||||
default = 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."
|
||||
default = 4096
|
||||
}
|
||||
|
||||
variable "vm_tpm_storage_pool" {
|
||||
type = string
|
||||
description = "Storage location virtual trusted platform module (vTPM)."
|
||||
}
|
||||
|
||||
variable "vm_tpm_version" {
|
||||
type = string
|
||||
description = "Version of virtual trusted platform module (vTPM). Can be 'v1.2' or 'v2.0' Defaults to 'v2.0'"
|
||||
default = "v2.0"
|
||||
}
|
||||
|
||||
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')"
|
||||
}
|
||||
|
||||
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')"
|
||||
}
|
||||
|
||||
variable "vm_video_ram" {
|
||||
type = number
|
||||
description = "The size for the video memory in KB."
|
||||
default = 4096
|
||||
}
|
||||
|
||||
variable "vm_video_displays" {
|
||||
type = number
|
||||
description = "The number of video displays."
|
||||
default = 1
|
||||
}
|
||||
|
||||
// Removable Media Settings
|
||||
|
||||
variable "common_iso_storage" {
|
||||
type = string
|
||||
description = "The name of the source Proxmox storage location for ISO images. (e.g. 'local')"
|
||||
}
|
||||
|
||||
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. One of `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_order" {
|
||||
type = string
|
||||
description = "The boot order for virtual machines devices."
|
||||
}
|
||||
|
||||
variable "vm_boot_wait" {
|
||||
type = string
|
||||
description = "The time to wait before boot."
|
||||
default = "5s"
|
||||
}
|
||||
|
||||
variable "vm_boot_command" {
|
||||
type = list(string)
|
||||
description = "The virtual machine boot command."
|
||||
default = ["<spacebar><spacebar>"]
|
||||
}
|
||||
|
||||
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."
|
||||
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 SHA-512 encrypted password to login to the guest operating system."
|
||||
sensitive = true
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "build_key" {
|
||||
type = string
|
||||
description = "The public key to login to the guest operating system."
|
||||
sensitive = true
|
||||
default = ""
|
||||
}
|
||||
|
||||
// Communicator Credentials
|
||||
|
||||
variable "communicator_port" {
|
||||
type = number
|
||||
description = "The port for the communicator protocol."
|
||||
default = 5985
|
||||
}
|
||||
|
||||
variable "communicator_timeout" {
|
||||
type = string
|
||||
description = "The timeout for the communicator protocol."
|
||||
default = "12h"
|
||||
}
|
||||
|
||||
// Ansible Credentials
|
||||
|
||||
variable "ansible_username" {
|
||||
type = string
|
||||
description = "The username for Ansible to login to the guest operating system."
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "ansible_key" {
|
||||
type = string
|
||||
description = "The public key for Ansible to login to the guest operating system."
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
// Provisioner Settings
|
||||
|
||||
variable "scripts" {
|
||||
type = list(string)
|
||||
description = "A list of scripts and their relative paths to transfer and run."
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "inline" {
|
||||
type = list(string)
|
||||
description = "A list of commands to run."
|
||||
default = []
|
||||
}
|
||||
|
||||
// HCP Packer Settings
|
||||
|
||||
variable "common_hcp_packer_registry_enabled" {
|
||||
type = bool
|
||||
description = "Enable the HCP Packer registry."
|
||||
default = false
|
||||
}
|
||||
322
builds/windows/desktop/11/windows.pkr.hcl
Normal file
322
builds/windows/desktop/11/windows.pkr.hcl
Normal file
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
Microsoft Windows 11 build definition.
|
||||
Packer Plugin for Proxmox: 'proxmox-iso' builder.
|
||||
*/
|
||||
|
||||
// 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 {
|
||||
build_by = "Built by: HashiCorp Packer ${packer.version}"
|
||||
build_date = formatdate("YYYY-MM-DD 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}"
|
||||
manifest_date = formatdate("YYYY-MM-DD hh:mm:ss", timestamp())
|
||||
manifest_path = "${path.cwd}/manifests/"
|
||||
manifest_output = "${local.manifest_path}${local.manifest_date}.json"
|
||||
vm_name_pro = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}-${var.vm_os_edition_pro}"
|
||||
vm_name_ent = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}-${var.vm_os_edition_ent}"
|
||||
bucket_name = replace("${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}", ".", "")
|
||||
bucket_description = "${var.vm_os_family} ${var.vm_os_name} ${var.vm_os_version}"
|
||||
}
|
||||
|
||||
// BLOCK: source
|
||||
// Defines the builder configuration blocks.
|
||||
|
||||
source "proxmox-iso" "windows-desktop-pro" {
|
||||
|
||||
// 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
|
||||
machine = var.vm_machine_type
|
||||
vm_name = local.vm_name_pro
|
||||
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
|
||||
qemu_agent = true
|
||||
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
|
||||
}
|
||||
|
||||
network_adapters {
|
||||
bridge = var.vm_bridge_interface
|
||||
model = var.vm_network_card_model
|
||||
vlan_tag = var.vm_vlan_tag
|
||||
}
|
||||
|
||||
tpm_config {
|
||||
tpm_storage_pool = var.vm_tpm_storage_pool
|
||||
tpm_version = var.vm_tpm_version
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
# Windows Server ISO File
|
||||
boot_iso {
|
||||
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
|
||||
unmount = true
|
||||
iso_checksum = var.iso_checksum
|
||||
type = "ide"
|
||||
index = 0
|
||||
}
|
||||
|
||||
// Removable Media Settings
|
||||
additional_iso_files {
|
||||
iso_file = "${var.common_iso_storage}:iso/virtio-win.iso"
|
||||
iso_storage_pool = var.common_iso_storage
|
||||
cd_label = "VirtIO"
|
||||
unmount = true
|
||||
}
|
||||
|
||||
additional_iso_files {
|
||||
cd_files = [
|
||||
"${path.cwd}/scripts/${var.vm_os_family}/"
|
||||
]
|
||||
cd_content = {
|
||||
"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
|
||||
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
|
||||
vm_guest_os_language = var.vm_os_language
|
||||
vm_guest_os_keyboard = var.vm_os_keyboard
|
||||
vm_guest_os_timezone = var.vm_os_timezone
|
||||
})
|
||||
}
|
||||
cd_label = "Unattend"
|
||||
iso_storage_pool = var.common_iso_storage
|
||||
unmount = true
|
||||
}
|
||||
|
||||
// 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
|
||||
boot_command = var.vm_boot_command
|
||||
|
||||
// Communicator Settings and Credentials
|
||||
communicator = "winrm"
|
||||
winrm_username = var.build_username
|
||||
winrm_password = var.build_password
|
||||
winrm_port = var.communicator_port
|
||||
winrm_timeout = var.communicator_timeout
|
||||
|
||||
template_name = local.vm_name_pro
|
||||
template_description = local.build_description
|
||||
|
||||
}
|
||||
|
||||
# Build Definition to create the VM Template
|
||||
source "proxmox-iso" "windows-desktop-ent" {
|
||||
|
||||
// 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
|
||||
machine = var.vm_machine_type
|
||||
vm_name = local.vm_name_ent
|
||||
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
|
||||
qemu_agent = true
|
||||
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
|
||||
}
|
||||
|
||||
network_adapters {
|
||||
bridge = var.vm_bridge_interface
|
||||
model = var.vm_network_card_model
|
||||
vlan_tag = var.vm_vlan_tag
|
||||
}
|
||||
|
||||
tpm_config {
|
||||
tpm_storage_pool = var.vm_tpm_storage_pool
|
||||
tpm_version = var.vm_tpm_version
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
# Windows Server ISO File
|
||||
boot_iso {
|
||||
|
||||
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
|
||||
unmount = true
|
||||
iso_checksum = var.iso_checksum
|
||||
type = "ide"
|
||||
index = 0
|
||||
}
|
||||
|
||||
// Removable Media Settings
|
||||
additional_iso_files {
|
||||
iso_file = "${var.common_iso_storage}:iso/virtio-win.iso"
|
||||
iso_storage_pool = var.common_iso_storage
|
||||
cd_label = "VirtIO"
|
||||
unmount = true
|
||||
}
|
||||
|
||||
additional_iso_files {
|
||||
cd_files = [
|
||||
"${path.cwd}/scripts/${var.vm_os_family}/"
|
||||
]
|
||||
cd_content = {
|
||||
"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
|
||||
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
|
||||
vm_guest_os_language = var.vm_os_language
|
||||
vm_guest_os_keyboard = var.vm_os_keyboard
|
||||
vm_guest_os_timezone = var.vm_os_timezone
|
||||
})
|
||||
}
|
||||
cd_label = "Unattend"
|
||||
iso_storage_pool = var.common_iso_storage
|
||||
unmount = true
|
||||
}
|
||||
|
||||
// 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
|
||||
boot_command = var.vm_boot_command
|
||||
|
||||
// Communicator Settings and Credentials
|
||||
communicator = "winrm"
|
||||
winrm_username = var.build_username
|
||||
winrm_password = var.build_password
|
||||
winrm_port = var.communicator_port
|
||||
winrm_timeout = var.communicator_timeout
|
||||
|
||||
template_name = local.vm_name_pro
|
||||
template_description = local.build_description
|
||||
|
||||
}
|
||||
// BLOCK: build
|
||||
// Defines the builders to run, provisioners, and post-processors.
|
||||
|
||||
build {
|
||||
sources = [
|
||||
"source.proxmox-iso.windows-desktop-pro",
|
||||
"source.proxmox-iso.windows-desktop-ent",
|
||||
]
|
||||
|
||||
provisioner "ansible" {
|
||||
user = "${var.build_username}"
|
||||
galaxy_file = "${path.cwd}/ansible/windows-requirements.yml"
|
||||
galaxy_force_with_deps = true
|
||||
use_proxy = false
|
||||
playbook_file = "${path.cwd}/ansible/windows-playbook.yml"
|
||||
roles_path = "${path.cwd}/ansible/roles"
|
||||
ansible_env_vars = [
|
||||
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg"
|
||||
]
|
||||
extra_arguments = [
|
||||
"--extra-vars", "use_proxy=false",
|
||||
"--extra-vars", "ansible_connection=winrm",
|
||||
"--extra-vars", "ansible_user='${var.build_username}'",
|
||||
"--extra-vars", "ansible_password='${var.build_password}'",
|
||||
"--extra-vars", "ansible_port='${var.communicator_port}'",
|
||||
"--extra-vars", "build_username='${var.build_username}'",
|
||||
]
|
||||
}
|
||||
|
||||
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}"
|
||||
}
|
||||
}
|
||||
}
|
||||
60
builds/windows/desktop/11/windows.pkrvars.hcl.example
Normal file
60
builds/windows/desktop/11/windows.pkrvars.hcl.example
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
DESCRIPTION:
|
||||
Microsoft Windows 11 build variables.
|
||||
Packer Plugin for Proxmox: 'proxmox-iso' builder.
|
||||
*/
|
||||
|
||||
// Installation Operating System Metadata
|
||||
vm_inst_os_eval = true
|
||||
vm_inst_os_language = "en-US"
|
||||
vm_inst_os_keyboard = "en-US"
|
||||
// There doesn't appear to be a Windows 11 Pro evaluation ISO
|
||||
// If you need to build Windows 11 Pro templates, you'll need the multi-edition ISO
|
||||
vm_inst_os_image_pro = "Windows 11 Enterprise Evaluation"
|
||||
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"
|
||||
|
||||
// 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"
|
||||
|
||||
// Virtual Machine Guest Operating System Setting
|
||||
vm_os_type = "win11"
|
||||
|
||||
// Machine type
|
||||
// Q35 less resource overhead and newer chipset
|
||||
vm_machine_type = "q35"
|
||||
|
||||
// Virtual Machine Hardware Settings
|
||||
vm_bios = "ovmf"
|
||||
vm_cpu_count = 2
|
||||
vm_cpu_sockets = 1
|
||||
vm_cpu_type = "x86-64-v2-AES"
|
||||
vm_mem_size = 4096
|
||||
vm_disk_type = "virtio"
|
||||
vm_disk_size = "32G"
|
||||
vm_disk_format = "raw"
|
||||
vm_disk_controller_type = "virtio-scsi-single"
|
||||
vm_network_card_model = "virtio"
|
||||
|
||||
// Removable Media Settings
|
||||
iso_path = "iso"
|
||||
iso_file = "22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
|
||||
iso_checksum = ""
|
||||
|
||||
// Boot Settings
|
||||
vm_boot_order = "order=virtio0;ide2;net0"
|
||||
|
||||
// EFI Settings
|
||||
vm_efi_storage_pool = "pool0"
|
||||
vm_firmware_path = "./OVMF.fd"
|
||||
|
||||
// TPM Settings
|
||||
vm_tpm_storage_pool = "pool0"
|
||||
27
config.sh
27
config.sh
@@ -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."
|
||||
|
||||
|
||||
30
scripts/windows/windows-init.ps1
Normal file
30
scripts/windows/windows-init.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Enables Windows Remote Management on Windows builds.
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Set network connections profile to Private mode.
|
||||
Write-Output 'Setting the network connection profiles to Private...'
|
||||
$connectionProfile = Get-NetConnectionProfile
|
||||
While ($connectionProfile.Name -eq 'Identifying...') {
|
||||
Start-Sleep -Seconds 10
|
||||
$connectionProfile = Get-NetConnectionProfile
|
||||
}
|
||||
Set-NetConnectionProfile -Name $connectionProfile.Name -NetworkCategory Private
|
||||
|
||||
# Set the Windows Remote Management configuration.
|
||||
Write-Output 'Setting the Windows Remote Management configuration...'
|
||||
winrm quickconfig -quiet
|
||||
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
||||
winrm set winrm/config/service/auth '@{Basic="true"}'
|
||||
|
||||
# Allow Windows Remote Management in the Windows Firewall.
|
||||
Write-Output 'Allowing Windows Remote Management in the Windows Firewall...'
|
||||
netsh advfirewall firewall set rule group="Windows Remote Administration" new enable=yes
|
||||
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=allow
|
||||
|
||||
# Reset the autologon count.
|
||||
# Reference: https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issue
|
||||
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 0
|
||||
99
scripts/windows/windows-virtio.ps1
Normal file
99
scripts/windows/windows-virtio.ps1
Normal file
@@ -0,0 +1,99 @@
|
||||
# Install Virtio Drivers
|
||||
|
||||
function Enable-Virtio {
|
||||
Write-Host "Installing Virtio Drivers"
|
||||
# Search and Install virtio-win-gt-x64.msi Script
|
||||
|
||||
# Get all file system drives
|
||||
$drives = Get-PSDrive -PSProvider 'FileSystem'
|
||||
|
||||
# Loop through each drive to find and run the MSI installer
|
||||
foreach ($drive in $drives) {
|
||||
$scriptFile = Join-Path $drive.Root 'virtio-win-gt-x64.msi'
|
||||
|
||||
# Check if the MSI file exists on the current drive
|
||||
if (Test-Path $scriptFile) {
|
||||
# Run the MSI installer with the specified arguments
|
||||
Start-Process msiexec -Wait -ArgumentList '/i', $scriptFile, '/log', 'C:\Windows\Temp\qemu-drivers.log', '/qn', '/passive', '/norestart', 'ADDLOCAL=ALL' -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
# Search and Install virtio-win-gt-x64.msi Script
|
||||
Write-Host "Installing QEMU Guest Agent"
|
||||
# Get all file system drives
|
||||
$drives = Get-PSDrive -PSProvider 'FileSystem'
|
||||
|
||||
# Loop through each drive to find and run the MSI installer
|
||||
foreach ($drive in $drives) {
|
||||
$scriptFile = Join-Path $drive.Root '/guest-agent/qemu-ga-x86_64.msi'
|
||||
|
||||
# Check if the MSI file exists on the current drive
|
||||
if (Test-Path $scriptFile) {
|
||||
# Run the MSI installer with the specified arguments
|
||||
Start-Process msiexec -Wait -ArgumentList '/i', $scriptFile, '/log', 'C:\Windows\Temp\qemu-guest-agent.log', '/qn', '/passive', '/norestart', 'ADDLOCAL=ALL' -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Write-Host "Installing SPICE"
|
||||
# # Search and Install virtio-win-guest-tools.exe
|
||||
|
||||
# # Get all file system drives
|
||||
# $drives = Get-PSDrive -PSProvider 'FileSystem'
|
||||
|
||||
# # Loop through each drive to find and run the MSI installer
|
||||
# foreach ($drive in $drives) {
|
||||
# $scriptFile = Join-Path $drive.Root 'virtio-win-guest-tools.exe'
|
||||
|
||||
# # Check if the MSI file exists on the current drive
|
||||
# if (Test-Path $scriptFile) {
|
||||
# # Run the MSI installer with the specified arguments
|
||||
# Start-Process msiexec -Wait -ArgumentList '/i', $scriptFile, '/log', 'C:\Windows\Temp\qemu-drivers.log', '/qn', '/passive', '/norestart', 'ADDLOCAL=ALL' -ErrorAction SilentlyContinue
|
||||
# }
|
||||
# }
|
||||
If (Get-service -Name QEMU-GA -ErrorAction SilentlyContinue) {
|
||||
Write-Host "Starting QEMU Guest Agent"
|
||||
Start-Service -Name QEMU-GA -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
If (Get-service -Name spice-agent -ErrorAction SilentlyContinue) {
|
||||
Write-Host "Starting SPICE"
|
||||
Start-Service -Name spice-agent -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Function Enable-WinRM {
|
||||
Write-Host "Enable WinRM"
|
||||
netsh advfirewall firewall set rule group="remote administration" new enable=yes
|
||||
netsh advfirewall firewall add rule name="WinRM open Port 5985" dir=in action=allow protocol=TCP localport=5985
|
||||
|
||||
winrm quickconfig -q
|
||||
winrm quickconfig -transport:http
|
||||
winrm set winrm/config '@{MaxTimeoutms="7200000"}'
|
||||
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
|
||||
winrm set winrm/config/winrs '@{MaxProcessesPerShell="0"}'
|
||||
winrm set winrm/config/winrs '@{MaxShellsPerUser="0"}'
|
||||
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
||||
winrm set winrm/config/service/auth '@{Basic="true"}'
|
||||
winrm set winrm/config/client/auth '@{Basic="true"}'
|
||||
|
||||
net stop winrm
|
||||
sc.exe config winrm start= auto
|
||||
net start winrm
|
||||
|
||||
}
|
||||
|
||||
# http://support.microsoft.com/kb/154501
|
||||
Write-Host "Disabling automatic machine account password changes"
|
||||
Get-WmiObject -Class Win32_UserAccount -Filter "name = 'Administrator'" | Set-WmiInstance -Arguments @{PasswordExpires = 0 }
|
||||
|
||||
$path = "HKLM:\System\CurrentControlSet\Services\Netlogon\Parameters"
|
||||
$key = try {
|
||||
Get-Item -Path $path -ErrorAction Stop
|
||||
}
|
||||
catch {
|
||||
New-Item -Path $path -Force
|
||||
}
|
||||
|
||||
Set-ItemProperty -Path $key.PSPath -Name DisablePasswordChange -Value 1
|
||||
|
||||
Enable-Virtio
|
||||
Enable-WinRM
|
||||
1
tests/.gitignore
vendored
Normal file
1
tests/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
output
|
||||
6
tests/network/golden/dhcp-autoinstall
Normal file
6
tests/network/golden/dhcp-autoinstall
Normal file
@@ -0,0 +1,6 @@
|
||||
network:
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
eth0:
|
||||
dhcp4: true
|
||||
1
tests/network/golden/dhcp-kickstart
Normal file
1
tests/network/golden/dhcp-kickstart
Normal file
@@ -0,0 +1 @@
|
||||
network --device=eth0 --bootproto=dhcp
|
||||
1
tests/network/golden/dhcp-preseed
Normal file
1
tests/network/golden/dhcp-preseed
Normal file
@@ -0,0 +1 @@
|
||||
d-i netcfg/choose_interface select eth0
|
||||
13
tests/network/golden/static-autoinstall
Normal file
13
tests/network/golden/static-autoinstall
Normal file
@@ -0,0 +1,13 @@
|
||||
network:
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
eth0:
|
||||
dhcp4: false
|
||||
addresses:
|
||||
- 192.168.100.192/24
|
||||
gateway4: 192.168.100.1
|
||||
nameservers:
|
||||
addresses:
|
||||
- 192.168.100.3
|
||||
- 192.168.100.1
|
||||
1
tests/network/golden/static-kickstart
Normal file
1
tests/network/golden/static-kickstart
Normal file
@@ -0,0 +1 @@
|
||||
network --device=eth0 --bootproto=static --ip=192.168.100.192 --netmask=255.255.255.0 --gateway=192.168.100.1 --nameserver=192.168.100.3,192.168.100.1
|
||||
7
tests/network/golden/static-preseed
Normal file
7
tests/network/golden/static-preseed
Normal file
@@ -0,0 +1,7 @@
|
||||
d-i netcfg/choose_interface select eth0
|
||||
d-i netcfg/disable_autoconfig boolean true
|
||||
d-i netcfg/get_ipaddress string 192.168.100.192
|
||||
d-i netcfg/get_netmask string 255.255.255.0
|
||||
d-i netcfg/get_gateway string 192.168.100.1
|
||||
d-i netcfg/get_nameservers string 192.168.100.3 192.168.100.1
|
||||
d-i netcfg/confirm_static boolean true
|
||||
19
tests/network/templates/autoinstall.pkrtpl
Normal file
19
tests/network/templates/autoinstall.pkrtpl
Normal file
@@ -0,0 +1,19 @@
|
||||
network:
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
%{ if ip != null ~}
|
||||
${device}:
|
||||
dhcp4: false
|
||||
addresses:
|
||||
- ${ip}/${netmask}
|
||||
gateway4: ${gateway}
|
||||
nameservers:
|
||||
addresses:
|
||||
%{ for item in dns ~}
|
||||
- ${item}
|
||||
%{ endfor ~}
|
||||
%{ else ~}
|
||||
${device}:
|
||||
dhcp4: true
|
||||
%{ endif ~}
|
||||
5
tests/network/templates/kickstart.pkrtpl
Normal file
5
tests/network/templates/kickstart.pkrtpl
Normal 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 ~}
|
||||
9
tests/network/templates/preseed.pkrtpl
Normal file
9
tests/network/templates/preseed.pkrtpl
Normal file
@@ -0,0 +1,9 @@
|
||||
d-i netcfg/choose_interface select ${device}
|
||||
%{ if ip != null ~}
|
||||
d-i netcfg/disable_autoconfig boolean true
|
||||
d-i netcfg/get_ipaddress string ${ip}
|
||||
d-i netcfg/get_netmask string ${cidrnetmask("${ip}/${netmask}")}
|
||||
d-i netcfg/get_gateway string ${gateway}
|
||||
d-i netcfg/get_nameservers string ${join(" ", dns)}
|
||||
d-i netcfg/confirm_static boolean true
|
||||
%{ endif ~}
|
||||
68
tests/network/test
Normal file
68
tests/network/test
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
||||
echo "$DIR"
|
||||
packer init -upgrade "$DIR"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f /tmp/tmpfile
|
||||
}
|
||||
|
||||
clean_blank_lines() {
|
||||
# Remove any blank lines that HCL likes to leave around
|
||||
awk 'NF' "$1" > /tmp/tmpfile && cat /tmp/tmpfile > "$1"
|
||||
}
|
||||
|
||||
## Test DHCP
|
||||
###############################################################################
|
||||
@test "network with Autoinstall using DHCP" {
|
||||
mkdir -p "$DIR/output/dhcp"
|
||||
packer build -var-file="$DIR/test-dhcp.pkrvars.hcl" -var "output_folder=$DIR/output/dhcp" -only "autoinstall.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/dhcp/autoinstall"
|
||||
run diff -u "$DIR/output/dhcp/autoinstall" "$DIR/golden/dhcp-autoinstall"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "network with Kickstart using DHCP" {
|
||||
mkdir -p "$DIR/output/dhcp"
|
||||
packer build -var-file="$DIR/test-dhcp.pkrvars.hcl" -var "output_folder=$DIR/output/dhcp" -only "kickstart.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/dhcp/kickstart"
|
||||
run diff -u "$DIR/output/dhcp/kickstart" "$DIR/golden/dhcp-kickstart"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "network with Preseed using DHCP" {
|
||||
mkdir -p "$DIR/output/dhcp"
|
||||
packer build -var-file="$DIR/test-dhcp.pkrvars.hcl" -var "output_folder=$DIR/output/dhcp" -only "preseed.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/dhcp/preseed"
|
||||
run diff -u "$DIR/output/dhcp/preseed" "$DIR/golden/dhcp-preseed"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
## Test static IP
|
||||
###############################################################################
|
||||
@test "network with Autoinstall using static IP" {
|
||||
mkdir -p "$DIR/output/static"
|
||||
packer build -var-file="$DIR/test-static.pkrvars.hcl" -var "output_folder=$DIR/output/static" -only "autoinstall.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/static/autoinstall"
|
||||
run diff -u "$DIR/output/static/autoinstall" "$DIR/golden/static-autoinstall"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "network with Kickstart using static IP" {
|
||||
mkdir -p "$DIR/output/static"
|
||||
packer build -var-file="$DIR/test-static.pkrvars.hcl" -var "output_folder=$DIR/output/static" -only "kickstart.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/static/kickstart"
|
||||
run diff -u "$DIR/output/static/kickstart" "$DIR/golden/static-kickstart"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "network with Preseed using static IP" {
|
||||
mkdir -p "$DIR/output/static"
|
||||
packer build -var-file="$DIR/test-static.pkrvars.hcl" -var "output_folder=$DIR/output/static" -only "preseed.*" "$DIR"
|
||||
run clean_blank_lines "$DIR/output/static/preseed"
|
||||
run diff -u "$DIR/output/static/preseed" "$DIR/golden/static-preseed"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
1
tests/network/test-dhcp.pkrvars.hcl
Normal file
1
tests/network/test-dhcp.pkrvars.hcl
Normal file
@@ -0,0 +1 @@
|
||||
// Nothing to set for DHCP
|
||||
4
tests/network/test-static.pkrvars.hcl
Normal file
4
tests/network/test-static.pkrvars.hcl
Normal file
@@ -0,0 +1,4 @@
|
||||
vm_ip_address = "192.168.100.192"
|
||||
vm_ip_netmask = 24
|
||||
vm_ip_gateway = "192.168.100.1"
|
||||
vm_dns_list = ["192.168.100.3", "192.168.100.1"]
|
||||
57
tests/network/test.pkr.hcl
Normal file
57
tests/network/test.pkr.hcl
Normal file
@@ -0,0 +1,57 @@
|
||||
source "null" "test" {
|
||||
communicator = "none"
|
||||
}
|
||||
|
||||
locals {
|
||||
autoinstall = templatefile("${abspath(path.root)}/templates/autoinstall.pkrtpl", {
|
||||
device = var.vm_network_device,
|
||||
ip = var.vm_ip_address,
|
||||
netmask = var.vm_ip_netmask,
|
||||
gateway = var.vm_ip_gateway,
|
||||
dns = var.vm_dns_list,
|
||||
})
|
||||
kickstart = templatefile("${abspath(path.root)}/templates/kickstart.pkrtpl", {
|
||||
device = var.vm_network_device,
|
||||
ip = var.vm_ip_address,
|
||||
netmask = var.vm_ip_netmask,
|
||||
gateway = var.vm_ip_gateway,
|
||||
dns = var.vm_dns_list,
|
||||
})
|
||||
preseed = templatefile("${abspath(path.root)}/templates/preseed.pkrtpl", {
|
||||
device = var.vm_network_device,
|
||||
ip = var.vm_ip_address,
|
||||
netmask = var.vm_ip_netmask,
|
||||
gateway = var.vm_ip_gateway,
|
||||
dns = var.vm_dns_list,
|
||||
})
|
||||
}
|
||||
|
||||
build {
|
||||
name = "autoinstall"
|
||||
sources = ["source.null.test"]
|
||||
provisioner "shell-local" {
|
||||
inline = [
|
||||
"echo '${local.autoinstall}' > ${var.output_folder}/autoinstall",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
name = "kickstart"
|
||||
sources = ["source.null.test"]
|
||||
provisioner "shell-local" {
|
||||
inline = [
|
||||
"echo '${local.kickstart}' > ${var.output_folder}/kickstart",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
name = "preseed"
|
||||
sources = ["source.null.test"]
|
||||
provisioner "shell-local" {
|
||||
inline = [
|
||||
"echo '${local.preseed}' > ${var.output_folder}/preseed",
|
||||
]
|
||||
}
|
||||
}
|
||||
34
tests/network/variables.pkr.hcl
Normal file
34
tests/network/variables.pkr.hcl
Normal file
@@ -0,0 +1,34 @@
|
||||
variable "vm_network_device" {
|
||||
type = string
|
||||
description = "The network device of the VM."
|
||||
default = "eth0"
|
||||
}
|
||||
|
||||
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 = []
|
||||
}
|
||||
|
||||
variable "output_folder" {
|
||||
type = string
|
||||
description = "The output folder for the generated files."
|
||||
}
|
||||
101
validate.sh
Executable file
101
validate.sh
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user