feat(templates): add starter runbook workspace (#5)

Document the notebook format and provide SSH-key, hardening-check, and package-install examples with inventory and credential exclusions.
This commit is contained in:
Florian Schmidt
2026-11-16 00:04:45 +01:00
parent 7cf1ef82ba
commit 91ac1df8a5
6 changed files with 289 additions and 0 deletions
@@ -0,0 +1,52 @@
---
title: Install and enable a package
params:
host: { type: host, required: true, label: Debian server }
package: { type: name, required: true, default: nginx, label: Package }
service: { type: name, required: true, default: nginx, label: Systemd service }
---
# Install and enable {{package}}
For Debian hosts using apt and systemd. Check the package/service pairing before
running; installing packages can start services and expose network ports. Existing
apt indexes must be available. Runs require passwordless sudo and confirmation.
```sh {check host="{{host}}" id=apt-available title="APT is available"}
command -v apt-get
command -v systemctl
```
```sh {check host="{{host}}" id=package-available title="Package exists in configured repositories"}
apt-cache show -- {{package}} > /dev/null
```
```sh {check host="{{host}}" id=installed title="Package already installed"}
dpkg-query -W -f='${Status}\n' -- {{package}} | grep -qx 'install ok installed'
```
An absent package is an expected failed check. Proceed with installation only
after the repository check succeeds.
```sh {run host="{{host}}" id=install title="Install package if absent" sudo confirm timeout=300}
if ! dpkg-query -W -f='${Status}\n' -- {{package}} 2>/dev/null | grep -qx 'install ok installed'; then
DEBIAN_FRONTEND=noninteractive apt-get install -y -- {{package}}
fi
```
```sh {run host="{{host}}" id=enable title="Enable and start service" sudo confirm timeout=60}
systemctl enable --now -- {{service}}
```
```sh {check host="{{host}}" id=enabled title="Service enabled"}
systemctl is-enabled -- {{service}}
```
```sh {check host="{{host}}" id=active title="Service active"}
systemctl is-active -- {{service}}
```
:::after{step=enable}
The enable command succeeded. Run the final checks and verify application health
and firewall policy before directing traffic to **{{host}}**.
:::