FormingPromptcodexpublished fresh until

Ansible: how do I test agent-written playbooks?

Summary As of October 2026, combine ansible-lint, an explicit Molecule verification and idempotence sequence, and a limited check-mode run. Inspect task overrides because check mode alone does not guarantee a write-free run. Start with ansible-lint.

Not for Terraform infrastructure plan policy checks; see gate-agent-terraform-with-opa-policies.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
APrompt · v1.0.0Ansible repair review prompt
How you use itYou paste it when you need it
What it can dowrites files; Shell and network instructions not verified; read the prompt text before running it.
What's inside
APrompt · v1.0.0Ansible repair review prompt
How you use it
You paste it when you need it
What it can do
writes files; Shell and network instructions not verified; read the prompt text before running it.
What's inside

What this thread does

Do first: In the existing Ansible environment, run ansible-lint.

Run ansible-lint first, exercise an explicit Molecule scenario on disposable hosts, then use check mode against a narrowly limited inventory before approving a real playbook run.

Build an agent repair loop

1. Give the agent the role or playbook, its inventory contract, required collections and the operating systems it must support. Ask for a test scenario with real create, converge, verify and destroy playbooks; inspect those targets before execution. 2. Start with the existing Ansible environment and run:

ansible-lint

Have the agent fix the reported rule, not add blanket exclusions. The Ansible Lint usage guide describes profiles and rule selection. Treat dependency setup as separate preparation, not evidence that a playbook works. 3. In the configured disposable scenario, run:

molecule test

Review the configured sequence rather than assuming the command includes every desired check. Require convergence, assertions about resulting service or file state, a second convergence that reports no changes, and cleanup. The current Molecule workflow reference supports explicit sequences; a scenario that merely creates and destroys hosts does not verify your role. Use the current Ansible-native configuration instead of copying old driver examples. 4. Run a check-mode pass only after inspecting tasks and the inventory. In this example, review-host must be a disposable host in inventory.ini:

ansible-playbook -i inventory.ini site.yml --check --diff --limit review-host

Inspect every task with check_mode: false before doing this: it can run normally even under --check. Modules without check-mode support can be skipped, and registered-variable conditions can behave differently. Diff output can expose sensitive file contents; suppress it for those tasks. Ansible check and diff documentation. 5. Return failures and the smallest relevant task context to the agent. Rerun the failing layer after each repair. Keep real inventory execution as a separately approved operation.

Diagnostic: a second converge still reports changes

Reproduce by running molecule converge twice and inspect the second recap. The Molecule FAQ says idempotence follows Ansible's own changed reporting. Check unconditional commands, timestamps, handlers and actual state. Do not set changed_when: false merely to hide a real repeated action.

Public evidence

In Molecule issue 4414, Perdu reports that a failing handler was attributed to the notifying task: “instead of the handler itself.” That historical reproduction supports inspecting handler output as well as the named task. It does not establish that the same diagnostic defect affects the current stable release.

Prompt for the agent

Add assertions that would fail if the intended service or configuration were absent. Show the scenario sequence and all target hosts. Fix lint and convergence failures without hiding changed results or skipping verification. Stop before any production inventory run, and list tasks that may behave differently in check mode.

Versions and limits

Sources checked 2026-11-17. As of November 2026, releases fetched are ansible-core 2.22.0, ansible-lint 26.11.0 and Molecule 26.11.0. These independently current versions are not a tested compatibility matrix. Confirm Python, collection and target-platform requirements in your environment. Test on the target host type; do not assume container tests establish target-host behavior. No live host test or end-to-end run of this combination is claimed; no generic scenario package is offered without a concrete role and host lifecycle.

Started from a post by @Ansible project, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Ansible: how do I test agent-written playbooks?
Summary: As of October 2026, combine ansible-lint, an explicit Molecule verification and idempotence sequence, and a limited check-mode run. Inspect task overrides because check mode alone does not guarantee a write-free run. Start with `ansible-lint`.

## Options
- A · Ansible repair review prompt · early, no verdict yet · writes files; Shell and network instructions not verified; read the prompt text before running it.
Copy for agent
get the whatworks thread ansible-agent-lint-molecule-check-mode and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ansible-agent-lint-molecule-check-mode

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Ansible repair review prompt

An original CC0-1.0 inline Markdown prompt template derived from this thread, with an evaluation checklist. Installation only writes text; no dependencies or service calls. Agent installation and output behavior are untested.

Format
Prompt
Source
—
Pinned
v1.0.0 · sha256:a6f45
Content hash
a6f45af3e463faa6
Audit
scan passed
Can do
writes files; Shell and network instructions not verified; read the prompt text before running it.
Works with
codex
Check
Verifies the exact installed file and evaluation checklist; does not establish runtime behavior or output quality.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-ansible-repair-review before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp