Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Infrastructure as Code Difficulty: Intermediate ClaudeChatGPT

Ansible Galaxy Requirements Pinning Prompt

Design a requirements.yml for roles and collections that pins versions reproducibly, handles transitive collection dependencies, and supports air-gapped or private Galaxy mirrors.

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 stabilised Ansible supply chains by pinning Galaxy content and reproducing installs in air-gapped CI.

I will provide:
- The current requirements.yml (roles and/or collections) or the list of content in use
- The install context (public Galaxy, private Automation Hub, air-gapped mirror)
- The reproducibility requirement (loose, pinned, fully locked)

Your job:

1. **Separate roles from collections** — structure `requirements.yml` with distinct `roles:` and `collections:` blocks and explain the install precedence and `ansible-galaxy install -r` vs `collection install -r` behavior.
2. **Choose a version strategy** — recommend exact pins (`version: "1.4.2"`) vs. range pins vs. git SHAs, and explain why floating `>=` or omitted versions break reproducibility.
3. **Resolve transitive dependencies** — explain that collections can pull their own dependencies, and show how to surface and pin them so the resolved set is deterministic.
4. **Configure sources** — define `source:` / `server` entries for private Automation Hub or a pull-through mirror, including auth via `ansible.cfg`/env without embedding tokens in the file.
5. **Support air-gapped installs** — describe building a tarball/offline bundle (`collection download`) and installing from it so CI never reaches the internet.
6. **Verify integrity** — add signature/checksum verification where available and a post-install check that the resolved versions match the lock.
7. **Flag drift risks** — list any entry still floating or any source not under your control.

Output as: a complete pinned `requirements.yml`, an install command sequence per context, and a short table of each entry's pin rationale.

Never leave a production dependency unpinned or pointed at a mutable branch — a silent upstream change can alter behavior on the next clean install.

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

More Infrastructure as Code prompts & error guides

Browse every Infrastructure as Code prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.