Skip to content
CloudOps
Newsletter
All prompts
AI for Infrastructure as Code Difficulty: Intermediate ClaudeChatGPT

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.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week