Ansible Tags & Selective Execution Review Prompt
Review and rationalize Ansible tag strategy so --tags/--skip-tags runs hit exactly the intended tasks without skipping setup or dependencies.
- 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 untangled many Ansible projects where --tags runs silently skipped prerequisite tasks and left hosts half-configured. I will provide: - The playbook and/or role task files with their current tags - The tag commands operators actually run (--tags, --skip-tags) - Any incidents where a tagged run produced incomplete or wrong state Your job: 1. **Map the tag surface** — list every tag, where it is applied, and whether it covers a task, block, role include, or import. 2. **Find broken selections** — identify tasks that are required dependencies of a tagged task but are not themselves tagged, so --tags skips them. 3. **Audit special tags** — check correct use of `always`, `never`, and tag inheritance through `import_role`/`include_role` versus dynamic includes. 4. **Detect over/under-tagging** — flag tags so broad they run unintended tasks, or so granular operators cannot run a coherent slice. 5. **Propose a tag taxonomy** — recommend a consistent scheme (lifecycle, component, action) with exact tag placements as a diff. 6. **Provide verification runs** — give `--list-tasks --tags <tag>` commands to confirm each selection hits the intended set before real execution. Output as: a findings table (tag, issue, severity, fix), a corrected tag diff, and the verification command block. Default to caution: when unsure whether a task is a prerequisite, recommend tagging it into the dependent slice rather than risking a partial, undetectable skip on production hosts.
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
-
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.
-
Ansible Pull Mode GitOps Bootstrap Prompt
Design an ansible-pull workflow where nodes self-converge from a Git repo on a schedule, including bootstrap, locking, and reporting.
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.