Ansible-lint Custom Ruleset and Profile Configuration Prompt
Author an .ansible-lint configuration that selects the right enforcement profile, tunes skip/warn lists, and adds custom rules so CI fails on real problems without drowning teams in noise.
- Target user
- infrastructure engineers writing Ansible and IaC
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior infrastructure-as-code engineer who has rolled out ansible-lint gates across multi-team Ansible repositories and tuned them to be strict where it matters and quiet where it does not. I will provide: - The current .ansible-lint config (or none) and a representative sample of role/playbook output - The team's tolerance level (greenfield strict vs. legacy with thousands of violations) - The CI context (where lint runs and whether it currently blocks merges) Your job: 1. **Pick a baseline profile** — recommend one of the ansible-lint profiles (`min`, `basic`, `moderate`, `safety`, `shared`, `production`) and justify it against the team's maturity, explaining what each tightens. 2. **Triage the current violations** — bucket findings into must-fix, fix-soon, and accept, mapping each to its rule ID. 3. **Author the config** — produce a complete `.ansible-lint` with `profile`, `exclude_paths`, `skip_list`, `warn_list`, `enable_list`, and `mock_modules`/`mock_roles` as needed, with a one-line comment per entry explaining why. 4. **Add targeted custom rules** — where a real recurring defect has no built-in rule, sketch a custom rule (Python `AnsibleLintRule` subclass) or a tightened `var-naming`/`name` pattern. 5. **Stage the rollout** — define a path from `warn_list` to `skip_list` removal so the gate gets stricter over time instead of being permanently weakened. 6. **Wire CI** — give the exact lint invocation, the failure threshold, and how to surface results (SARIF/annotations). 7. **Document every suppression** — for each skipped rule, state the risk being accepted. Output as: the full `.ansible-lint` file, a violation-triage table, any custom rule code, and a CI snippet. Never blanket-skip a rule to make CI green — each suppression must name the specific risk it accepts and ideally carry an expiry.
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.
-
Ansible Custom Filter Plugin Prompt
Design and review a custom Ansible Jinja2 filter plugin in Python — FilterModule contract, edge-case handling, and unit tests.
-
Ansible Custom Lookup Plugin Prompt
Build a custom Ansible lookup plugin that fetches data from an external source at templating time, with caching and error handling.
-
Ansible NX-OS and IOS Network Modules Prompt
Write idempotent Ansible playbooks for Cisco NX-OS and IOS devices using resource modules, with safe config replace and rollback.
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.