/infra-skills:ansible-conventionsfrom infra-skills
Use when writing, changing or reviewing Ansible roles, playbooks, or inventory. Covers repository structure, runtime secret injection, Jinja2/bash delimiter traps, boot-only hardware services, and idempotent check-mode runs.
Ships in infra-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
All managed hosts use the project's standard ansible_user from its platform-conventions local skill, if it defines one — not root. That user has SSH key authentication and passwordless sudo.
Inventory lives at ansible/inventory/. Host definitions cover every host Ansible manages — hypervisor nodes, standalone VMs — per the project's topology local skill.
Secrets are never stored on disk. Inject them at runtime with a wrapper that resolves references when the playbook starts. The shape is the same whatever the backend — a committed file of references, resolved into env vars for one invocation:
<secret-runner> --env-file=ansible/<refs>.env -- ansible-playbook playbooks/<playbook>.yml
The env file holds references only (secret-manager URIs or paths), never values. Password-manager CLIs, sops exec-env, and vault agents all fit this pattern; which one the project uses, and its reference paths, belong in the project's secret-paths local skill, if it defines one. Never hardcode credentials in playbooks, vars files, or inventory. Where encrypted-at-rest vars are unavoidable, use ansible-vault and keep the vault password out of the repo.
Roles live under ansible/roles/ — one role per host responsibility, not one per task. A role owns everything for its host class. Example layout:
| Role | Purpose |
|---|---|
<management-vm>/ | Standalone management VM configuration (e.g. container runtime, reverse proxy, auth stack) |
<hypervisor>_power/ | Host power tuning (e.g. CPU governor, GPU power services) |
The project's concrete role inventory lives in its platform-conventions local skill, if it defines one.
Some systemd services manipulate hardware in ways that are only safe at boot (example: a GPU idle-power service that unbinds GPUs from their current drivers to set minimum power limits). Never use state: started or state: restarted on such services — starting one while the hardware is in use (e.g. a VM holding the GPU) can hang or crash the host.
Correct usage — enable without starting:
- name: Enable <boot-only-service>
ansible.builtin.systemd:
name: <boot-only-service>
enabled: true
daemon_reload: true
# No 'state:' key — boot-only service, never started by Ansible
Which of the project's services are boot-only is recorded in its platform-conventions local skill, if it defines one.
Bash array syntax ${#array[@]} conflicts with Jinja2's comment tag {# ... #}. In templates that mix bash and Jinja2, add this header:
#jinja2: comment_start_string:'{##', comment_end_string:'##}'
This remaps Jinja2's comment delimiters so {# is treated as literal bash.
Some services deliberately live outside any cluster on Ansible-managed hosts (e.g. a small utility container on a management VM). Manage them via their host's role — never assume every service is a Kubernetes workload. The project's topology local skill, if it defines one, records which services live where.
All playbooks and roles must be safe to run repeatedly. Test with --check --diff before applying to production hosts. Use changed_when: false for commands that are inherently read-only but trigger changed state in Ansible's model.
ansible_user matches the project's inventory convention, not rootstate: key; no task starts or restarts onechanged_when: false--check --diff run, report no changesWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
8 skills in this plugin
/github-actions-conventionsUse when writing or reviewing GitHub Actions workflows or CI. Covers workflow structure, action pinning, secret access, gh CLI usage, uv-based Python jobs, gitleaks scanning, and automated-commit patterns./go-public-reviewUse before making a GitHub repository public, or when reviewing a public one. Audits history, commit metadata and PR refs for exposed content, plus branch and tag rules, docs, public CI, security policy and licence; grades each finding./infra-seamsUse when a diff touches secret-sync objects, tolerations, storage classes, RBAC, or an LLM/tool gateway's access config. Detects infrastructure seam crossings, states the authority delta, seeds the seams registry./k8s-diagnosticsUse when running a Kubernetes health sweep or diagnosing a failing node, pod, GitOps sync or secret sync. Gives kubectl, GitOps-controller and secret-sync checks per sweep section; node-OS tooling defers to topology./k8s-kustomize-conventionsUse when writing, changing or reviewing Kubernetes manifests or Kustomize files. Defines base-and-overlay structure, patch patterns, manifest validation, image-transform limits, and how overlays map to GitOps sync targets./k8s-workload-patternsUse when writing or reviewing a Kubernetes workload, choosing Deployment vs StatefulSet vs DaemonSet vs Job, or sizing a pod. Covers resources, probes, storage, security context, runtime class, and exposure.npx claudepluginhub pixeloven/crew --plugin infra-skills