
ansible-generator
Generate, create, or scaffold Ansible playbooks, roles, tasks, handlers, inventory, vars.
- Installs
- 817
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/akin-ozer/cc-devops-skills --skill ansible-generator- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads ansible-generator automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Ansible Generator
Trigger Phrases
Use this skill when the request is to generate or scaffold Ansible content, for example:
- "Create a playbook to deploy nginx with TLS."
- "Generate an Ansible role for PostgreSQL backups."
- "Write inventory files for prod and staging."
- "Build reusable Ansible tasks for user provisioning."
- "Initialize an Ansible project with ansible.cfg and requirements.yml."
- "Give me a quick Ansible snippet to install Docker."
Do not use this skill as the primary workflow when the request is validation/debug-only (syntax errors, lint failures, Molecule/test failures). Use ansible-validator for those cases.
Deterministic Execution Flow
Run these stages in order. Do not skip a stage unless the Validation Exceptions Matrix explicitly allows it.
Stage 0: Classify Request Mode
Determine one mode first:
| Mode | Typical user intent | Deliverable |
|---|---|---|
full-generation | "create/build/generate" a full playbook/role/inventory/project file set | Complete file(s), production-ready |
snippet-only | "quick snippet/example" without full file context | Focused task/play snippet |
docs-only | explanation, pattern comparison, or conceptual guidance only | Explanatory content, optional examples |
Stage 1: Collect Minimum Inputs
If details are missing, ask briefly. If the user does not provide them, proceed with safe defaults and state assumptions.
| Resource type | Required inputs | Safe defaults if missing |
|---|---|---|
| Playbook | target hosts, privilege (become), OS family, objective | hosts: all, become: false, OS-agnostic modules |
| Role | role name, primary service/package, supported OS | role name from task domain, Debian + RedHat vars |
| Tasks file | operation scope, required vars, execution context | standalone reusable tasks with documented vars |
| Inventory | environments, host groups, hostnames/IPs | production/staging groups with placeholders |
| Project config | collections/roles dependencies, lint policy | minimal ansible.cfg, requirements.yml, .ansible-lint |
Stage 2: Reference Extraction Checklist
Before drafting content, extract the following from local references/templates.
Required references
references/best-practices.md- Extract: FQCN requirements, idempotency rules, naming, security expectations.
references/module-patterns.md- Extract: correct module/parameter patterns for the exact task type.
Required templates by output type
- Playbook:
assets/templates/playbook/basic_playbook.yml - Role:
assets/templates/role/(includingmeta/argument_specs.ymlandmolecule/default/for test scaffolding) - Inventory (INI):
assets/templates/inventory/hosts - Inventory (YAML):
assets/templates/inventory/hosts.yml - Project config:
assets/templates/project/ansible.cfg,assets/templates/project/requirements.yml,assets/templates/project/.ansible-lint
Extraction checks
- Identify every
[PLACEHOLDER]that must be replaced. - Decide module selection priority (
ansible.builtin.*first). - Capture at least one OS-appropriate package pattern when OS-specific behavior is needed.
- Capture required prerequisites (collections, binaries, target assumptions).
Stage 3: Generate
Apply these generation standards:
- Use FQCN module names (
ansible.builtin.*first choice). - Keep tasks idempotent (
state,creates/removes,changed_whenwhen needed). - Use descriptive verb-first task names.
- Use
true/falsebooleans (notyes/no). - Add
no_log: truefor sensitive values. - Replace all placeholders before presenting output.
- Prefer
ansible.builtin.dnffor RHEL 8+/CentOS 8+ (legacyyumonly for older systems).
Stage 4: Validate (Default) or Apply Exception (Fallback)
Use the matrix below to keep validation deterministic and non-blocking.
Validation Exceptions Matrix
| Scenario | Default behavior | Allowed fallback | What to report |
|---|---|---|---|
full-generation | Run ansible-validator after generation and after each fix pass | If validator/tools are unavailable, run manual static checks (YAML shape, placeholder scan, FQCN/idempotency/security review) and provide exact deferred validation commands | Explicitly list which checks ran, which were skipped, and why |
snippet-only | Skip full validator by default; do inline sanity checks | Run full validator only if user asks or snippet is promoted to full file | State that validation was limited because output is snippet-only |
docs-only | No runtime validation | None needed | State that no executable artifact was generated |
| Offline environment (no web/docs access) | Continue with local references and templates | Skip external doc lookups; prefer builtin-module implementations; provide notes for later external verification | State offline constraint and impacted checks/lookups |
Resource Generation Guidance
Playbooks
- Use
assets/templates/playbook/basic_playbook.ymlas structure. - Include: header comments,
pre_tasks/tasks/post_tasksas needed, handlers, tags. - Add health checks when service deployment/configuration is involved.
Roles
- Build from
assets/templates/role/structure. - Keep defaults in
defaults/main.yml; keep higher-priority role vars invars/main.yml. - Include OS-specific vars (
vars/Debian.yml,vars/RedHat.yml) when relevant. - Add
meta/argument_specs.ymlfor variable validation. - Include
molecule/default/scaffold (fromassets/templates/role/molecule/) for production-ready roles.
Task Files
- Keep scope narrow and reusable.
- Document required input variables in comments.
- Use conditionals for environment/OS-sensitive operations.
Inventory
- Build logical host groups and optional group hierarchies.
- Use variable layering intentionally:
group_vars/all.yml-> group -> host. - Default to INI format (
hosts) for simple topologies; use YAML format (hosts.yml) when the user requests it or when the hierarchy is complex.
Project Configuration
- Provide baseline
ansible.cfg,requirements.yml, and.ansible-lint. - Keep defaults practical and editable.
Custom Modules and Collections
When the request depends on non-builtin modules/collections:
- Identify collection + module and required version sensitivity.
- Check local
references/module-patterns.mdfirst. - If still unresolved and network/tools are available, query Context7:
mcp__context7__resolve-library-idmcp__context7__query-docs
- If Context7 is unavailable, use official Ansible docs / Ansible Galaxy pages.
- If external lookup is unavailable, provide a builtin fallback approach and state the limitation.
Always include collection installation guidance when collection modules are used.
Canonical Example Flows
Flow A: Full Generation (Playbook)
User prompt: "Create a playbook to deploy nginx with TLS on Ubuntu and RHEL."
- Classify as
full-generation. - Gather/confirm required inputs (hosts, cert paths, become, service name).
- Extract required references (
best-practices.md,module-patterns.md) and playbook template. - Generate complete playbook with OS conditionals (
apt/dnf), handlers, validation for config templates. - Run
ansible-validator. - Fix issues and rerun until checks pass (or apply matrix fallback if tooling unavailable).
- Present output with validation summary, usage command, and prerequisites.
Flow B: Quick Snippet (Task Block)
User prompt: "Give me a snippet to create a user and SSH key."
- Classify as
snippet-only. - Extract minimal module patterns for
ansible.builtin.userandansible.builtin.authorized_key. - Generate concise snippet with FQCN, idempotency, and variable placeholders.
- Perform inline sanity checks (YAML shape, FQCN, obvious idempotency/security).
- Present snippet and note that full validator run was skipped due to snippet-only mode.
Output Requirements
For generated executable artifacts, use this response structure:
## Generated [Resource Type]: [Name]
**Validation Status:** [Passed / Partially validated / Skipped with reason]
- YAML syntax: [status]
- Ansible syntax: [status]
- Lint: [status]
**Summary:**
- [What was generated]
- [Key implementation choices]
**Assumptions:**
- [Defaults or inferred values]
**Usage:**
```bash
[Exact command(s)]
Prerequisites:
- [Collections, binaries, environment needs]
## Done Criteria
This skill execution is complete only when all applicable items are true:
- Trigger decision is explicit (`full-generation`, `snippet-only`, or `docs-only`).
- Required references/templates were consulted for the selected artifact type.
- Generated output has no unresolved placeholders.
- Validation followed default behavior or a documented exception from the matrix.
- Any skipped checks include a concrete reason and deferred command(s).
- Final output includes summary, assumptions, usage, and prerequisites.
FAQ
What does the ansible-generator skill do?
Generate, create, or scaffold Ansible playbooks, roles, tasks, handlers, inventory, vars.
How do I install ansible-generator?
Run npx skills add https://github.com/akin-ozer/cc-devops-skills --skill ansible-generator in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ansible-generator/ (personal) or .claude/skills/ansible-generator/ (project).
Which AI agents can use ansible-generator?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is ansible-generator safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains ansible-generator?
It is published by akin-ozer in akin-ozer/cc-devops-skills. It has 817 recorded installs.
More from akin-ozer/cc-devops-skills
ansible-validator
akin-ozer/cc-devops-skills
Validate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks.
terragrunt-generator
akin-ozer/cc-devops-skills
Generate/create/scaffold Terragrunt HCL files — root.hcl, terragrunt.hcl, child modules, stacks, multi-env layouts.
k8s-debug
akin-ozer/cc-devops-skills
Diagnose and fix Kubernetes pods, CrashLoopBackOff, Pending, DNS, networking, storage, and rollout failures with kubectl.
jenkinsfile-generator
akin-ozer/cc-devops-skills
Generate/create/scaffold Jenkinsfile — declarative, scripted, shared library, CI/CD pipelines.
dockerfile-validator
akin-ozer/cc-devops-skills
Validate, lint, audit, or scan a Dockerfile for security and best practices.
dockerfile-generator
akin-ozer/cc-devops-skills
Create, generate, or write Dockerfiles and multi-stage Docker images. Containerize apps.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.