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>
41 lines
1.4 KiB
Bash
Executable File
41 lines
1.4 KiB
Bash
Executable File
#!/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
|