feat(ansible): Playbooks as one list, and a page per playbook that runs it (#5331, #5330)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 55s
CI / unit (push) Failing after 1m20s
CI / publish (push) Skipped

- /ansible/playbooks lists every playbook across sources: what it says it
  does, its category and destructive flag, how it last ran; the whole row
  opens the playbook. A source with none is one quiet line.
- /ansible/playbooks/<source>/<path>: the verdict (what it does, flagged
  destructive, last ran), the run form in place (dry run beside the button,
  options folded), the schedules that use it, its recent runs, the playbook
  itself folded. ?from=<run> fills the form from that run: Run again on a
  run's page.
- /ansible/browse, its view page and the /run-form fragment are gone, not
  redirected (rule 122); every link points at the new pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 23:49:05 -04:00
co-authored by Claude Opus 5.5
parent a02f224f22
commit 72a3261582
17 changed files with 447 additions and 230 deletions
+12 -1
View File
@@ -60,7 +60,12 @@ def test_the_runs_tab_counts_and_filters(app):
out = {"page": await get(f"/ansible/?q=it{tag}"),
"failed": await get(f"/ansible/?q=it{tag}&status=failed", headers={"HX-Request": "true"}),
"sched": await get(f"/ansible/?q=it{tag}&origin=schedule", headers={"HX-Request": "true"}),
"person": await get(f"/ansible/?q=it{tag}&origin=manual", headers={"HX-Request": "true"})}
"person": await get(f"/ansible/?q=it{tag}&origin=manual", headers={"HX-Request": "true"}),
# The Playbooks tab and a built-in playbook's page (#5331): their
# newest-run and schedule queries against Postgres.
"playbooks": await get("/ansible/playbooks"),
"playbook": await get("/ansible/playbooks/steward-builtin/maintenance/docker_prune.yml"),
"missing": await get("/ansible/playbooks/steward-builtin/nope.yml")}
async with app.db_sessionmaker() as s:
async with s.begin():
from sqlalchemy import delete
@@ -83,3 +88,9 @@ def test_the_runs_tab_counts_and_filters(app):
assert f"it{tag}/prune.yml" in sched and f"it{tag}/update.yml" not in sched
person = out["person"][1]
assert f"it{tag}/update.yml" in person and f"it{tag}/prune.yml" not in person
status, playbooks = out["playbooks"]
assert status == 200 and 'href="/ansible/playbooks/steward-builtin/maintenance/docker_prune.yml"' in playbooks
status, playbook = out["playbook"]
assert status == 200 and "The playbook" in playbook and 'id="run-form"' not in playbook # a viewer
assert out["missing"][0] == 404