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
-
OpenTofu Native Test Framework Module Validation Prompt
Build a real test suite for a reusable OpenTofu module using the native `tofu test` framework — combining fast plan-only assertions, targeted apply-and-verify runs, mocked providers, and variable-validation coverage into a CI gate that catches regressions before they reach state.
-
Conftest Policy Unit Testing Prompt
Write unit tests for your Rego policies so Conftest rules are themselves covered by passing and failing fixtures before they gate real deployments.
-
Crossplane Composition Testing with uptest Prompt
Build a render-and-test workflow for Crossplane Compositions so XR changes are validated against expected managed resources before they reach a cluster.
-
Ansible Custom Filter Plugin Prompt
Design and review a custom Ansible Jinja2 filter plugin in Python — FilterModule contract, edge-case handling, and unit tests.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code prompt and troubleshooting guide in one place.
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.