feat(templates): LXC container and chained web server notebooks (#11)

infra/lxc-container.md creates an unprivileged container on a Proxmox
host with ShellBook's key, waits for its address and adds it to Hosts.
services/web-server.md installs nginx on an existing host or on a new
container through ::use. Document chaining in the spec (3.6) and in the
workspace format guide.
This commit is contained in:
Florian Schmidt
2026-11-16 11:42:12 +01:00
parent 845d6c828e
commit 85afd105f7
4 changed files with 212 additions and 1 deletions
+26 -1
View File
@@ -111,4 +111,29 @@ add `failed` for failure. Refer to a real step ID. Each local run gets a fresh
uploads to transfer earlier results. Artifacts expire after 24 hours by default;
private keys are sensitive, downloadable once, then removed. Do not commit them.
See the three notebooks for complete SSH-key, read-only hardening and Debian package examples.
## Choices, chaining and new hosts
````markdown
:::when{target=lxc}
Shown, and runnable, only while the choice parameter `target` is `lxc` (or `a,b` for several).
::use{notebook="infra/lxc-container.md" as=ct with="hostname={{server_name}}"}
:::
```sh {run host="{{host}}" id=install}
apt-get install -y nginx
```
````
- `::use` includes another notebook (path relative to `notebooks/`). Its parameters
appear in their own form group as `alias.name`; refer to its captures as
`{{ct.address}}` and to its steps as `ct.<id>`. `with` sets defaults for its
parameters using this notebook's names. Never bind secrets.
- Defaults may reference captures: `host: { type: host, required: true, default: "{{ct.host}}" }`.
Only reference captures of *another* notebook from required parameters; within one
notebook make such parameters optional (e.g. `ctid: { type: name, default: "{{nextid}}" }`).
- `::host{name="{{hostname}}" address="{{address}}" user=root port=22 capture=host}`
offers to add a created machine to Hosts and stores its name in `{{host}}`.
- `{{shellbook.public_key}}` is ShellBook's SSH public key, e.g. for `pct create --ssh-public-keys`.
See the notebooks for complete SSH-key, read-only hardening, Debian package, LXC
container (`infra/lxc-container.md`) and chained service (`services/web-server.md`) examples.