feat(core): parameter fields in text, groups and gating by used values (#16)

- `::param{name=x}` places a parameter's input inside the text.
- `:::group{title="…" collapsed}` is a collapsible container for anything;
  groups are presentational and never gate steps. Included notebooks
  namespace field names and group titles.
- `groupInputs` reports a container's input status (missing, filled,
  optional, none) from its fields, the parameters its steps use and, for
  `::use`, the included notebook's parameters.
- A step is gated only by the values it uses: referenced parameters, the
  required secrets its script reads and valid set secrets of its scope.
  Unused required parameters no longer block early steps of a guided
  runbook.
- Spec §3.2/§3.6/§3.7, workspace format guide and a guided admin-user
  example notebook.
This commit is contained in:
Florian Schmidt
2026-11-16 16:49:47 +01:00
parent cae72c7f28
commit bdbcd2dcd5
10 changed files with 475 additions and 31 deletions
@@ -0,0 +1,58 @@
---
title: Create an admin user
params:
host: { type: host, required: true, label: Target server }
user: { type: name, required: true, label: User name }
pubkey: { type: string, required: true, label: Public SSH key }
shell: { type: path, default: /bin/bash, label: Login shell }
---
# Create an admin user
A guided runbook: each section asks for what it needs where it is explained. A
section's outline turns green once its values are filled in. For Debian hosts;
runs need passwordless sudo and ask for confirmation.
:::group{title="1. Pick the server"}
Choose the machine from Hosts. This check only reads state.
::param{name=host}
```sh {check host="{{host}}" id=can-sudo title="Passwordless sudo works" sudo}
true
```
:::
:::group{title="2. Describe the user"}
Pick a login name (letters, digits, `.`, `_`, `-`) and paste the public key the
user logs in with, e.g. the content of their `~/.ssh/id_ed25519.pub`.
::param{name=user}
::param{name=pubkey}
::param{name=shell}
```sh {check host="{{host}}" id=user-free title="User does not exist yet"}
! id {{user}}
```
:::
:::group{title="3. Create the user"}
Creates **{{user}}** in the `sudo` group and authorizes the key.
```sh {run host="{{host}}" id=create title="Create user and authorize key" sudo confirm}
useradd --create-home --shell {{shell}} --groups sudo {{user}}
install -d -m 700 -o {{user}} -g {{user}} /home/{{user}}/.ssh
printf '%s\n' {{pubkey}} > /home/{{user}}/.ssh/authorized_keys
chown {{user}}:{{user}} /home/{{user}}/.ssh/authorized_keys
chmod 600 /home/{{user}}/.ssh/authorized_keys
```
:::
:::group{title="4. Verify" collapsed}
```sh {check host="{{host}}" id=verify title="User is in sudo and has the key" sudo}
id -nG {{user}} | grep -qw sudo
test -s /home/{{user}}/.ssh/authorized_keys
```
:::