Refactor Debian 13 Trixie Packer templates for LUKS support

- Removed obsolete variable files: variables-common.pkr.hcl and variables.pkr.hcl.
- Updated debian-trixie.pkr.hcl to include local values for LUKS configuration.
- Modified boot command to include LUKS arguments based on the enable_luks variable.
- Enhanced initial-setup.sh to support LUKS detection and resizing.
- Replaced preseed.cfg with preseed.cfg.pkrtpl for dynamic LUKS configuration.
- Added enable_luks variable to control LUKS encryption during image build.
- Introduced luks.pkrvars.hcl for LUKS-specific variable settings.
- Updated mise.toml to support new variable file argument for Packer builds.
This commit is contained in:
Philip Henning 2026-05-11 19:13:11 +02:00
parent e57f2d977b
commit eded7180dc
20 changed files with 281 additions and 2445 deletions

View file

@ -17,7 +17,7 @@
| Template ID | OS | Version | Path | LUKS encrypted? | Mac Address | IP Address |
| :---------- | :--------------------------------------------------------------------------------------------- | :-------- | :---------------------- | :-------------- | :---------------- | :---------------------- |
| 65000 | <img src="https://www.debian.org/logos/openlogo-nd.svg" alt="Debian logo" height="16"/> Debian | 13-trixie | `debian/13-trixie-luks` | ✅ | BC:24:11:00:13:37 | 192.168.9.29 (via DHCP) |
| 65000 | <img src="https://www.debian.org/logos/openlogo-nd.svg" alt="Debian logo" height="16"/> Debian | 13-trixie | `debian/13-trixie` | optional | BC:24:11:00:13:37 | 192.168.9.29 (via DHCP) |
## Repository structure
@ -28,14 +28,14 @@ Name
├──  _scripts/ Support scripts for building templates.
│ └──  unlock-luks-after-install.py* Unlocks the LUKS encrypted Disk on the 1st Boot after installation.
├──  debian/ Debian template definitions and assets (Packer templates, cloud-init/KS files, provisioning files).
│ └──  13-trixie-luks/ Template definition and assets for the Trixie template.
│ └──  13-trixie/ Template definition and assets for the Trixie template.
│ ├──  files/ Files used for the file provisioner.
│ │ ├── 󱁻 99-pve.cfg Configures the data sources for cloud-init.
│ │ └──  debian.sources Debian package sources.
│ ├──  http/ Files that Packer provides during build via http.
│ │ ├── 󱁻 ks.cfg Kickstart configuration.
│ ├── 󰡯 meta-data cloud-init configuration.
│ │ └── 󰡯 user-data cloud-init configuration.
│ │ └── 󱁻 preseed.cfg.pkrtpl Debian preseed template.
├──  variants/ Packer var-files for optional image variants.
│ │ └──  luks.pkrvars.hcl Enables LUKS encryption.
│ ├──  credentials.auto.pkrvars.hcl -> ../../credentials.auto.pkrvars.hcl Local secrets for Packer (API token, endpoints) used at build time.
│ ├──  debian-trixie.pkr.hcl The build template.
│ ├──  variables-common.pkr.hcl -> ../../variables-common.pkr.hcl Shared Packer variables used by templates.
@ -88,12 +88,27 @@ To build a template run:
mise run build <path-to-template-directory>
```
## Build LUKS encrypted Templates
To build a template run:
For Debian 13 Trixie without LUKS:
```shell
mise run build-luks <path-to-template-directory>
mise run build debian/13-trixie
```
## Build LUKS encrypted Templates
Debian LUKS builds use the same template directory and enable encryption through
`debian/13-trixie/variants/luks.pkrvars.hcl`.
To build a LUKS encrypted Debian 13 Trixie template run:
```shell
mise run build-luks debian/13-trixie
```
The equivalent direct Packer command is:
```shell
packer build -var-file=debian/13-trixie/variants/luks.pkrvars.hcl debian/13-trixie
```
## Setup new templates
@ -104,4 +119,4 @@ Run:
mise run setup <distribution name> <version>
```
E.g. `mise run setup debian 13-trixie` or `mise run setup debian 13-trixie-luks`.
E.g. `mise run setup debian 13-trixie`.