Ansible Deprecated Module to FQCN Migration Prompt
Convert short module names and deprecated syntax to fully-qualified collection names and current parameters, with a per-change rationale and verification plan.
- Target user
- Ansible engineers clearing deprecation warnings before a major-version upgrade
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior automation engineer who has migrated large playbook estates onto fully-qualified collection names (FQCN) and cleared deprecation warnings ahead of major ansible-core upgrades. You know which short names map to which collection and which renamed parameters changed behavior, not just spelling. I will paste playbooks/roles and (optionally) the deprecation warnings from a run. Your job is to produce a precise migration to FQCN and current syntax, change by change, that I can review before applying. Steps: 1. **Map every short module name to its FQCN**: e.g. `yum`/`apt`/`service`/`copy`/`template` to their `ansible.builtin.*` form, and community/galaxy modules to their owning collection. If a module moved or was renamed, say so and give the new name. 2. **Flag deprecated modules with replacements**: where a module is deprecated in favor of another (not just renamed), explain the replacement and any behavioral difference. 3. **Fix deprecated parameters and warn-level syntax**: renamed args, removed args, `warn:` on command/shell, bare variables in `when`, and other items the run flagged. 4. **List required collections**: produce the `collections` entries / `requirements.yml` additions needed so the FQCN names resolve, with version pins where a parameter depends on a minimum version. 5. **Rationale per change**: for each edit give a one-line reason (pure rename vs behavioral change vs removed-in-next-major). Fill in: - Files to migrate: [PASTE OR LIST PATHS + CONTENT] - Deprecation warnings from the run, if any: [PASTE] - Target ansible-core version: [e.g. 2.17] - Collections already installed: [LIST OR "unknown"] Output format: a unified-diff-style block per file showing only the changed lines, then a `requirements.yml` snippet for any new collections, then a verification checklist (run `ansible-lint`, run `--syntax-check`, run `--check --diff` on one host, confirm zero deprecation warnings). Separate pure renames from behavioral changes in a short summary. Do not apply the changes or run the playbook for real. Behavioral-change edits must be called out explicitly so I review them before any run on managed hosts.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Deprecation cleanups go wrong when someone bulk-replaces short names and ships it, not realizing a couple of those “renames” were actually behavioral replacements or depended on a collection that isn’t pinned. The prompt forces the model to separate pure renames from behavioral changes and to emit the matching requirements.yml entries, so the FQCN names actually resolve at run time instead of failing with “couldn’t resolve module.”
Asking for a unified-diff per file keeps the change set small and reviewable. You see exactly which lines move, with a one-line reason each, rather than a regenerated role you have to diff yourself. That rationale column is what lets you fast-track the trivial renames and slow down on the handful that change behavior.
The verification checklist closes the loop with the tools that actually prove the migration: --syntax-check and ansible-lint catch resolution errors, and a single-host --check --diff confirms the renamed parameters still produce the same intended state before you touch the fleet.
Related prompts
-
Ansible Check-Diff Dry-Run Review Plan Prompt
Build a --check --diff dry-run plan that predicts what a playbook will change, flags tasks that lie in check mode, and gives a go/no-go review before the real run.
-
Ansible Collection ansible-test Sanity and Unit Setup Prompt
Stand up ansible-test sanity and unit testing for a collection so module and plugin changes are validated in CI before they ship to Galaxy.
-
Ansible Callback Plugin Authoring Prompt
Draft a custom callback plugin that hooks play/task events for profiling, structured logging, or notifications without changing any playbook.
-
Ansible when/Conditional Logic Review Prompt
Audit and rewrite fragile when-conditionals so they are correct across types, undefined vars, and loops — eliminating silently-skipped or silently-run tasks.
More Ansible prompts & error guides
Browse every Ansible 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.