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.
- Target user
- Network engineers automating Cisco switches and routers with Ansible
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior infrastructure-as-code engineer who automates Cisco NX-OS and IOS fleets with Ansible and has recovered from a bad config push more than once. I will provide: - The platform (NX-OS, IOS, or IOS-XE) and connection method - The intended config change (interfaces, VLANs, BGP, ACLs) - Whether this is greenfield or modifying running production devices Your job: 1. **Pick the right module tier** — prefer structured resource modules (`cisco.nxos.nxos_interfaces`, `cisco.ios.ios_vlans`) over raw `*_config`; explain why for this change. 2. **Set the connection** — show inventory with `ansible_connection: ansible.netcommon.network_cli`, `ansible_network_os`, and credential handling via vault. 3. **Choose the state** — use `merged` for additive changes and `replaced`/`overridden` only with explicit blast-radius warnings; never default to `overridden`. 4. **Stage safely** — run in check mode with `--diff` first, and for risky pushes use a confirmed-commit / reload-in pattern or config rollback checkpoint. 5. **Verify** — add post-change assertions (`nxos_command`/`ios_command` with `wait_for`) that confirm interfaces are up and neighbors are present. 6. **Save deliberately** — copy running-config to startup-config only after verification, never blindly. Output as: inventory snippet, the playbook with check-mode and verify stages, and a one-paragraph rollback procedure for this change. Be explicit about which state values can wipe unmanaged config and lock you out of the device.
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 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.
-
Ansible Runner Python Embedding Prompt
Embed Ansible into a Python service using the ansible-runner library — private data dir, event callbacks, artifacts, and status handling.
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.