Discovery iPXE + %pre collection template + catalog entry #5

Open
opened 2026-08-05 00:54:40 +10:00 by unkinben · 1 comment
Owner

Problem

There is no discovery artifact set. ipxe/ has boot, fallback-shell, fallback-local; kickstart/ has an image.ks.tmpl and per-distro templates; catalog/ has per-model entries (optiplex-3050/3060/3070/7080, *-image). None of these collect a machine's hardware identity or LLDP topology at first boot, which bootapi needs to auto-populate NetBox for an unknown device (see bootapi companion issue).

Proposal

Add the template/catalog side of the discovery boot flow:

  1. ipxe/discovery.ipxe.tmpl — chained by bootapi on a NetBox-miss; loads the discovery live image (kernel/initrd from bootapi-images) with a kernel arg pointing back at the bootapi discover endpoint.
  2. kickstart/discovery.ks.tmpl (or a live-image init) — a %pre-style stage that runs and POSTs JSON to bootapi:
    • dmidecode -s system-serial-number / system-product-name / system-uuid (+ board, chassis).
    • ip -j link to enumerate every physical NIC (name + MAC + operstate) — no enp2s0 assumption (3060 = enp1s0); match key is MAC / lowest physical NIC.
    • lldpctl -f json (install/run lldpd in the image) for switch chassis-id/sysname + port — the sole topology source.
    • optional lscpu/free/lsblk -J inventory.
      Emits one JSON blob curl -X POST to $discover_url (kernel arg), then reboot.
  3. catalog/discovery.yaml — describes the discovery image (kernel/initrd artifact names in bootapi-images, packages: dmidecode, iproute, lldpd, curl).
  4. Where the image lives: bootapi-images builds the discovery kernel+initrd (mirror the existing *-image catalog pattern, e.g. optiplex-7080-image/almalinux9-image).

Acceptance

  • discovery.ipxe.tmpl + discovery.ks.tmpl (or live-init) + catalog/discovery.yaml exist and render.
  • The %pre/init collects serial/model/UUID, all NICs (name+MAC, enumeration-based), and lldpctl neighbours, and POSTs them to bootapi's discover endpoint, then reboots.
  • shellcheck-post passes; interface handling has no hardcoded NIC name.
  • bootapi-images produces the discovery kernel/initrd referenced by the catalog entry.

Cross-refs

  • bootapi: NetBox-miss → serve discovery chain; discover endpoint that consumes this POST and writes NetBox (companion issue).
  • bootapi-images: build the discovery live image.
## Problem There is no discovery artifact set. `ipxe/` has `boot`, `fallback-shell`, `fallback-local`; `kickstart/` has an `image.ks.tmpl` and per-distro templates; `catalog/` has per-model entries (`optiplex-3050/3060/3070/7080`, `*-image`). None of these collect a machine's hardware identity or LLDP topology at first boot, which bootapi needs to auto-populate NetBox for an unknown device (see bootapi companion issue). ## Proposal Add the template/catalog side of the discovery boot flow: 1. **`ipxe/discovery.ipxe.tmpl`** — chained by bootapi on a NetBox-miss; loads the discovery live image (kernel/initrd from bootapi-images) with a kernel arg pointing back at the bootapi discover endpoint. 2. **`kickstart/discovery.ks.tmpl`** (or a live-image init) — a `%pre`-style stage that runs and POSTs JSON to bootapi: - `dmidecode -s system-serial-number` / `system-product-name` / `system-uuid` (+ board, chassis). - `ip -j link` to enumerate every physical NIC (name + MAC + operstate) — **no `enp2s0` assumption** (3060 = `enp1s0`); match key is MAC / lowest physical NIC. - `lldpctl -f json` (install/run `lldpd` in the image) for switch chassis-id/sysname + port — the sole topology source. - optional `lscpu`/`free`/`lsblk -J` inventory. Emits one JSON blob `curl -X POST` to `$discover_url` (kernel arg), then `reboot`. 3. **`catalog/discovery.yaml`** — describes the discovery image (kernel/initrd artifact names in bootapi-images, packages: `dmidecode`, `iproute`, `lldpd`, `curl`). 4. Where the image lives: **bootapi-images** builds the discovery kernel+initrd (mirror the existing `*-image` catalog pattern, e.g. `optiplex-7080-image`/`almalinux9-image`). ## Acceptance - `discovery.ipxe.tmpl` + `discovery.ks.tmpl` (or live-init) + `catalog/discovery.yaml` exist and render. - The `%pre`/init collects serial/model/UUID, all NICs (name+MAC, enumeration-based), and `lldpctl` neighbours, and POSTs them to bootapi's discover endpoint, then reboots. - shellcheck-post passes; interface handling has no hardcoded NIC name. - bootapi-images produces the discovery kernel/initrd referenced by the catalog entry. ## Cross-refs - bootapi: NetBox-miss → serve discovery chain; discover endpoint that consumes this POST and writes NetBox (companion issue). - bootapi-images: build the discovery live image.
Author
Owner

Companion: unkin/bootapi#3 (bootapi discovery decision + NetBox writes).

Companion: unkin/bootapi#3 (bootapi discovery decision + NetBox writes).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/bootapi-templates#5