Stateless (Warewulf-style) provisioning: profiles, node pools, overlays, dnsmasq export, compute image
Profiles bind a RAM-booted root image to overlay templates; assigning a machine allocates a node name and management IP, writes the per-MAC PXE entry with a per-node token and exports static leases for dnsmasq. Nodes pull rendered overlays (hosts, slurm.conf from inventory, gres.conf, SSH host key, munge key) through rollcall-overlay.service; the runtime refresh timer is the heartbeat. Adds the compute-debian13 image definition and a generic live-build root image script, CLI and web UI for profiles/assign. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
1430421a3f
commit
7fe7c26e22
38 files changed
+1543
-16
No files matched your search
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# Build a stateless (RAM-booted) root image with live-build.
|
||||
#
|
||||
# build-rootfs.sh <image-name>
|
||||
#
|
||||
# Reads images/<image-name>/{packages.list,hook.chroot,includes/} and writes
|
||||
# <IMAGES_DIR>/<image-name>/{vmlinuz,initrd.img,filesystem.squashfs}, which
|
||||
# rollcall serves under /images/<image-name>/ and pxelinux loads via TFTP.
|
||||
set -euo pipefail
|
||||
NAME=${1:?image name}
|
||||
SRC=$(cd "$(dirname "$0")" && pwd)/$NAME
|
||||
[ -d "$SRC" ] || { echo "no such image definition: $SRC" >&2; exit 1; }
|
||||
IMAGES_DIR=${IMAGES_DIR:-/srv/rollcall/images}
|
||||
BUILD=${BUILD:-/srv/rollcall/build-$NAME}
|
||||
MIRROR=${MIRROR:-http://deb.debian.org/debian}
|
||||
DIST=${DIST:-trixie}
|
||||
AUTHKEYS=${AUTHKEYS:-/home/ilker/.ssh/authorized_keys}
|
||||
OUT=$IMAGES_DIR/$NAME
|
||||
|
||||
mkdir -p "$BUILD" "$OUT"
|
||||
cd "$BUILD"
|
||||
if [ -d config ]; then lb clean --purge >/dev/null 2>&1 || true; rm -rf config; fi
|
||||
|
||||
lb config \
|
||||
--distribution "$DIST" --architectures amd64 \
|
||||
--archive-areas "main contrib non-free non-free-firmware" \
|
||||
--mirror-bootstrap "$MIRROR" --mirror-binary "$MIRROR" \
|
||||
--binary-images iso-hybrid --bootloaders syslinux \
|
||||
--debian-installer none --memtest none \
|
||||
--firmware-chroot true --firmware-binary false \
|
||||
--apt-recommends false \
|
||||
--bootappend-live "boot=live components" \
|
||||
--linux-flavours amd64 \
|
||||
--iso-volume "$NAME" --iso-application "rollcall $NAME" \
|
||||
--cache-packages true --cache-indices false >/dev/null
|
||||
|
||||
install -m 0644 "$SRC/packages.list" "config/package-lists/$NAME.list.chroot"
|
||||
mkdir -p config/includes.chroot config/hooks/live
|
||||
if [ -d "$SRC/includes" ]; then cp -a "$SRC/includes/." config/includes.chroot/; fi
|
||||
if [ -r "$AUTHKEYS" ]; then
|
||||
install -d -m 0700 config/includes.chroot/root/.ssh
|
||||
install -m 0600 "$AUTHKEYS" config/includes.chroot/root/.ssh/authorized_keys
|
||||
fi
|
||||
if [ -f "$SRC/hook.chroot" ]; then install -m 0755 "$SRC/hook.chroot" "config/hooks/live/0100-$NAME.hook.chroot"; fi
|
||||
|
||||
echo "=== lb build $NAME started $(date)"
|
||||
lb build 2>&1 | tee "$BUILD/build.log" | grep -E "^P: (Begin|Build)|^E:" || true
|
||||
|
||||
for f in vmlinuz initrd.img filesystem.squashfs; do
|
||||
src=$(ls binary/live/$f* 2>/dev/null | head -1)
|
||||
[ -n "$src" ] || { echo "missing $f in binary/live (see $BUILD/build.log)" >&2; exit 1; }
|
||||
install -m 0644 "$src" "$OUT/$f.new" && mv -f "$OUT/$f.new" "$OUT/$f"
|
||||
done
|
||||
ls -la "$OUT"
|
||||
echo "=== done $(date)"
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# live-build chroot hook for the compute image
|
||||
set -e
|
||||
systemctl enable rollcall-overlay.service rollcall-overlay-runtime.timer
|
||||
systemctl enable munge.service slurmd.service ssh.service
|
||||
systemctl disable apt-daily.timer apt-daily-upgrade.timer 2>/dev/null || true
|
||||
sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
||||
# host keys come from the overlay; do not let the package generate random ones first
|
||||
rm -f /etc/ssh/ssh_host_*
|
||||
install -d -m 0755 -o root -g root /var/spool/slurmd /var/log/slurm
|
||||
echo rollcall > /etc/hostname
|
||||
@@ -0,0 +1,3 @@
|
||||
[Unit]
|
||||
After=rollcall-overlay.service
|
||||
Requires=rollcall-overlay.service
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=rollcall: refresh node runtime overlay
|
||||
After=rollcall-overlay.service
|
||||
ConditionKernelCommandLine=rollcall.node
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/sbin/rollcall-overlay runtime
|
||||
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=rollcall: periodic runtime overlay refresh (also the node heartbeat)
|
||||
|
||||
[Timer]
|
||||
OnBootSec=2min
|
||||
OnUnitActiveSec=5min
|
||||
RandomizedDelaySec=30s
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=rollcall: apply node system overlay
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=munge.service slurmd.service ssh.service
|
||||
ConditionKernelCommandLine=rollcall.node
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/local/sbin/rollcall-overlay system
|
||||
StandardOutput=journal+console
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
After=rollcall-overlay.service munge.service
|
||||
Requires=rollcall-overlay.service
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
@@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
After=rollcall-overlay.service
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
# rollcall-overlay <system|runtime>
|
||||
# Fetches this node's overlay tarball from the rollcall server (identified by
|
||||
# the rollcall.node token on the kernel command line), applies it over / when
|
||||
# it changed, then runs /run/rollcall/post-<stage>.sh if the overlay shipped one.
|
||||
set -eu
|
||||
stage=${1:-system}
|
||||
SERVER=""; TOKEN=""
|
||||
for t in $(cat /proc/cmdline); do
|
||||
case $t in
|
||||
rollcall.server=*) SERVER=${t#*=} ;;
|
||||
rollcall.node=*) TOKEN=${t#*=} ;;
|
||||
esac
|
||||
done
|
||||
if [ -z "$SERVER" ] || [ -z "$TOKEN" ]; then
|
||||
echo "rollcall-overlay: rollcall.server/rollcall.node not on cmdline, nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
mkdir -p /run/rollcall
|
||||
tmp=/run/rollcall/$stage.tar.new
|
||||
i=0
|
||||
until curl -fsS --connect-timeout 5 -H "X-Rollcall-Node: $TOKEN" \
|
||||
"$SERVER/api/v1/nodes/self/overlay?stage=$stage" -o "$tmp"; do
|
||||
i=$((i+1))
|
||||
if [ "$i" -ge 60 ]; then echo "rollcall-overlay: server unreachable" >&2; exit 1; fi
|
||||
sleep 5
|
||||
done
|
||||
new=$(sha256sum "$tmp" | cut -d' ' -f1)
|
||||
old=$(cat "/run/rollcall/$stage.sha" 2>/dev/null || true)
|
||||
if [ "$new" = "$old" ]; then
|
||||
rm -f "$tmp"
|
||||
exit 0
|
||||
fi
|
||||
tar -C / -xpf "$tmp" --no-same-owner --overwrite
|
||||
mv -f "$tmp" "/run/rollcall/$stage.tar"
|
||||
echo "$new" > "/run/rollcall/$stage.sha"
|
||||
echo "rollcall-overlay: applied $stage overlay ($new)"
|
||||
if [ -f "/run/rollcall/post-$stage.sh" ]; then
|
||||
sh "/run/rollcall/post-$stage.sh" || echo "rollcall-overlay: post-$stage.sh failed" >&2
|
||||
fi
|
||||
@@ -0,0 +1,35 @@
|
||||
linux-image-amd64
|
||||
live-boot
|
||||
live-config
|
||||
live-config-systemd
|
||||
systemd-sysv
|
||||
systemd-timesyncd
|
||||
kmod
|
||||
pciutils
|
||||
ethtool
|
||||
iproute2
|
||||
isc-dhcp-client
|
||||
curl
|
||||
ca-certificates
|
||||
openssh-server
|
||||
openssh-client
|
||||
less
|
||||
vim-tiny
|
||||
procps
|
||||
numactl
|
||||
hwloc-nox
|
||||
ipmitool
|
||||
munge
|
||||
slurmd
|
||||
slurm-client
|
||||
rdma-core
|
||||
ibverbs-utils
|
||||
infiniband-diags
|
||||
nfs-common
|
||||
firmware-linux
|
||||
firmware-bnx2
|
||||
firmware-bnx2x
|
||||
firmware-qlogic
|
||||
firmware-realtek
|
||||
amd64-microcode
|
||||
intel-microcode
|
||||
Reference in new issue
Block a user