Set defaults and host policies
You can set creation defaults on your controller and policies on each host. Host policies affect every controller using that host. They are operator guardrails, not a security boundary: host SSH and sudo can change or bypass them, and older controllers do not enforce note policies.
Inspect before changing settings:
raft config --location labWithout --location, the report contacts every configured host and fails if one is unreachable. It includes effective default values and their sources, required note fields, stopped-box retention and policy change records.
Defaults for new
raft config set location lab
raft config set ttl 3600
raft config set cpu 2
raft config set memory 4GiB
raft config unset cpuYou can set location, ttl, cpu, memory, disk and disposable. See accepted values and built-in defaults. Explicit flags win over controller defaults, then built-in defaults. resume, fork, extend and recover do not use these defaults.
Setting disposable true makes new delete the box and snapshots on stop or expiry, including new --from. Use --persistent to keep one box. A fork stays persistent unless you explicitly pass --disposable.
Size defaults apply only to boxes created from the image. new --from keeps the snapshot's location, CPU, RAM and disk unless explicit flags change them. fork keeps the source sizes, with CPU/RAM overrides only. --disk shared overrides an own-disk default for image-based creation but is rejected with --from.
A disk default fails on hosts without own disks enabled or enough unreserved space. The error names defaults.disk; override with --disk shared or run raft config unset disk. Invalid keys, values or JSON fail instead of being ignored. Repair a recognized bad value with set or unset; edit malformed JSON or unknown keys in ~/.config/raft/config.json directly.
Require box notes
raft policy lab --require purpose,ownerFields are purpose, owner and next. A requirement must include purpose; use --require none to clear it. Missing or empty required fields reject new, fork, recover and note with the missing flags. Text accuracy is not checked.
new, including snapshot copies, uses only the note you supply. Fork and recovery inherit the source note unless you pass flags. Any note flags replace the whole note, so give every field the copy needs:
raft note "$box" --purpose "Project tests" --owner "Local operator" --next "Back up after tests"raft note "$box" --clear is rejected while required fields apply. Location notes are separate, unenforced guidance; set one with raft note lab "Preferred for builds".
Delete boxes left stopped
This policy permanently deletes stopped boxes and all their snapshots. Back up needed work and review the location before setting it:
raft policy lab --delete-stopped-after 48
raft list --location labDeletion becomes due 48 hours after the later of the stop time or the policy change. Setting the policy again, shortening it or lengthening it restarts that grace period. Running boxes are unaffected; resume clears the stop time and a later stop starts another clock.
A box stopped outside Raft, or recovered from backup, starts its clock when the worker first sees it. Use raft resume, not native Incus lifecycle commands: a native start and stop between worker checks can retain an old stop time.
The host enforces retention every 15 seconds and on raft gc, even with no controller connected. list shows due times as deleteAt. Clear automatic retention with raft policy lab --delete-stopped-after never. For manual cleanup, raft prune --location lab --older-than 7 previews candidates; adding --yes permanently deletes them and their snapshots. Running boxes and boxes without recorded stop times are excluded.
Check changes and failures
Policy commands report old and new values. raft config includes change times, the SSH account and a self-reported controller identity. On the host, sudo journalctl -t raft shows policy changes and retention deletions.
Disposable creation, prune and enabling retention require a compatible expiry worker. If you see Host expiry worker differs from this CLI, redeploy the matching release; do not bypass the check. Clearing retention with never does not require that worker check.