Full-stack-skills ansible
Provides comprehensive guidance for Ansible automation including playbooks, roles, inventory, and module usage. Use when the user asks about Ansible, needs to automate IT tasks, create Ansible playbooks, or manage infrastructure with Ansible.
install
source · Clone the upstream repo
git clone https://github.com/partme-ai/full-stack-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/partme-ai/full-stack-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/devops-skills/ansible" ~/.claude/skills/partme-ai-full-stack-skills-ansible && rm -rf "$T"
manifest:
skills/devops-skills/ansible/SKILL.mdsource content
When to use this skill
Use this skill whenever the user wants to:
- Write Ansible playbooks, roles, or inventory files
- Execute ad-hoc commands or run playbooks against hosts
- Use modules (package, copy, template, service, user, etc.) for configuration and deployment
- Handle variables, conditionals, loops, and error handling in Ansible
- Set up Ansible Vault for secrets management
How to use this skill
Workflow
- Define inventory — list target hosts in INI or YAML format
- Write playbook — define hosts, tasks, handlers, and vars in YAML
- Organize with roles — extract reusable tasks, templates, and defaults into roles
- Run and validate — execute with
and verify idempotencyansible-playbook
Quick Start Example
# site.yml --- - name: Deploy web application hosts: webservers become: true vars: app_port: 8080 tasks: - name: Install nginx ansible.builtin.package: name: nginx state: present - name: Deploy config from template ansible.builtin.template: src: templates/nginx.conf.j2 dest: /etc/nginx/nginx.conf notify: restart nginx handlers: - name: restart nginx ansible.builtin.service: name: nginx state: restarted
# Run the playbook ansible-playbook -i inventory/production site.yml # Ad-hoc ping all hosts ansible -m ping all
Key Commands
| Command | Purpose |
|---|---|
| Run a playbook |
| Test connectivity |
| Encrypt sensitive data |
| Scaffold a new role |
Best Practices
- Organize with roles and
hierarchy; avoid monolithic playbooksgroup_vars/host_vars - Encrypt sensitive data with
; use idempotent tasks withansible-vault
and conditionalsstate - Define explicit failure handling (
,ignore_errors
); use tags for selective runsblock/rescue - Control node requires Python; target hosts need SSH access; optionally use AWX/Tower for scheduling
Troubleshooting
- Connection refused: Verify SSH keys and
in inventoryansible_user - Module not found: Check Ansible version and use FQCN (e.g.,
)ansible.builtin.copy - Idempotency failures: Ensure tasks use
parameter and avoid shell commands where modules existstate
Keywords
ansible, playbook, role, inventory, automation, configuration management, ansible-vault, infrastructure