feat(ansible): playbooks self-describe via "# description:" comment
CI / lint (push) Successful in 3s
CI / unit (push) Successful in 8s
CI / integration (push) Successful in 2m15s
CI / publish (push) Successful in 52s

Playbooks can ship a human description Steward reads and shows when one is
selected. Convention: a `# description: <text>` magic comment (Ansible rejects
unknown play keys, so a comment is the portable place — works for third-party
playbooks too); falls back to the first play's name:. sources
.discover_playbook_description().

Surfaced at the top of the shared _playbook_vars.html partial, which loads on
playbook selection in the host run form, schedules form, and browse run form.
All four bundled playbooks (provision/install/update/docker_prune) now carry a
description line. Unit tests added.

Scribe #900.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 11:25:25 -04:00
parent a0d1c5f07c
commit e5f6a11f94
8 changed files with 75 additions and 6 deletions
+6 -2
View File
@@ -165,11 +165,14 @@ async def playbook_vars():
playbook_path = (request.args.get("playbook_path", "") or "").strip()
source = next((s for s in _get_sources() if s["name"] == source_name), None)
variables: list = []
description = ""
if source and playbook_path:
contents = src_module.read_playbook(source["path"], playbook_path)
if contents is not None:
variables = src_module.discover_playbook_variables(contents)
return await render_template("ansible/_playbook_vars.html", variables=variables)
description = src_module.discover_playbook_description(contents)
return await render_template(
"ansible/_playbook_vars.html", variables=variables, description=description)
@ansible_bp.get("/run-form/<source_name>/<path:playbook_path>")
@@ -186,6 +189,7 @@ async def run_form(source_name: str, playbook_path: str):
if contents is None:
return "Playbook not found", 404
variables = src_module.discover_playbook_variables(contents)
description = src_module.discover_playbook_description(contents)
inventories = src_module.discover_inventories(source["path"])
async with current_app.db_sessionmaker() as db:
@@ -197,7 +201,7 @@ async def run_form(source_name: str, playbook_path: str):
return await render_template(
"ansible/_run_form.html",
source_name=source_name, playbook_path=playbook_path,
variables=variables, targets=targets, groups=groups,
variables=variables, description=description, targets=targets, groups=groups,
inventories=inventories,
)