Claude-skill-registry ansible-playbook
Write and review Ansible playbooks following best practices. Use when the user says "write ansible", "ansible playbook", "review playbook", "automate with ansible", or asks to configure servers with Ansible.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/ansible-playbook" ~/.claude/skills/majiayu000-claude-skill-registry-ansible-playbook && rm -rf "$T"
manifest:
skills/data/ansible-playbook/SKILL.mdsource content
Ansible Playbook
Write and review Ansible playbooks, roles, and tasks following best practices.
Instructions
When writing:
- Understand the target configuration goal
- Check existing playbooks/roles for patterns to follow
- Write idempotent tasks with proper error handling
- Include appropriate tags and handlers
When reviewing:
- Read the playbook/role
- Check for issues listed below
- Suggest improvements
Playbook structure
--- - name: Configure web servers hosts: webservers become: true vars_files: - vars/main.yml handlers: - name: Restart nginx ansible.builtin.service: name: nginx state: restarted tasks: - name: Install nginx ansible.builtin.apt: name: nginx state: present update_cache: true notify: Restart nginx tags: [nginx, packages]
Best practices
- MUST use FQCNs:
notansible.builtin.copycopy - MUST use
for every taskname: - MUST use
explicitly, not assuming rootbecome: - Use handlers for service restarts
- Use
for error handlingblock/rescue/always - Use
for secretsansible-vault - Use variables for anything environment-specific
- Use
mode compatible tasks where possible--check
Security checks
- No plaintext passwords in playbooks
- Secrets in vault-encrypted files
on tasks with sensitive datano_log: true- File permissions explicitly set
- SSH keys not hardcoded
Common patterns
# Idempotent file content - name: Configure app ansible.builtin.template: src: app.conf.j2 dest: /etc/app/config mode: "0644" owner: app group: app validate: "/usr/bin/app --check %s" notify: Restart app # Package installation - name: Install packages ansible.builtin.apt: name: "{{ packages }}" state: present vars: packages: - nginx - certbot
Rules
- MUST use fully qualified collection names (FQCNs)
- MUST include task names
- Never hardcode secrets in playbooks
- Never use
when a module existsshell: - Always make tasks idempotent