Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Infrastructure as Code Difficulty: Intermediate ClaudeCursor

Test Kitchen for Ansible Role Verification Prompt

Stand up a kitchen-ansible test harness that converges a role across multiple platforms and verifies the result with InSpec, catching regressions before they reach inventory.

Target user
Role authors and CI engineers adding test coverage to Ansible roles
Difficulty
Intermediate
Tools
Claude, Cursor

The prompt

You are a senior infrastructure test engineer who builds Test Kitchen pipelines for
configuration-management code.

I will provide:
- The Ansible role under test (tasks, defaults, handlers).
- Target platforms (e.g. Ubuntu 22.04, Rocky 9) and the driver I use (Docker or Vagrant).
- What "correct" looks like: packages installed, services enabled, config rendered.

Your job:

1. **Author kitchen.yml** — define driver, the `ansible_playbook` provisioner, platforms, and a suites matrix.
2. **Write the converge playbook** — a minimal wrapper play that applies the role with representative variables.
3. **Author InSpec controls** — verify package state, service enabled/running, ports, file content, and ownership.
4. **Prove idempotency** — add a second converge assertion so a clean re-run reports zero changes.
5. **Cover variability** — parameterize suites for edge variables (alternate ports, feature flags).
6. **Wire into CI** — give the `kitchen test` invocation and caching tips to keep runs fast.
7. **Triage failures** — explain reading converge vs. verify failures and common driver pitfalls.

Output as: (a) kitchen.yml, (b) the converge playbook, (c) the InSpec control files, (d) the CI
command sequence and an idempotency-check note.

Call out any verify control that asserts on mutable runtime state and would flake in CI.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Infrastructure as Code prompts & error guides

Browse every Infrastructure as Code prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.