ansible
Use when the user asks about Ansible playbooks, roles, inventory, ansible-playbook, ansible-galaxy collections, Jinja2 templates, ansible-vault, AWX or…
от j4flmao★ 47 звёзд на GitHub
Установить ansible в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Ansible
Purpose
Automate configuration management, application deployment, and infrastructure orchestration using Ansible playbooks, roles, and modules with idempotency and security best practices.
Agent Protocol
Trigger
Exact user phrases: "Ansible", "ansible-playbook", "playbook", "inventory", "role", "task", "ansible-galaxy", "ansible-vault", "Ansible Tower", "AWX", "Ansible Automation Platform".
Input Context
Before activating, verify:
- Managed node OS (RHEL, Debian, Windows, network devices) — affects module selection.
- Inventory source (static INI/YAML, dynamic from cloud/inventory plugin).
- Authentication method (SSH key, password with sshpass, WinRM, API token).
- Ansible control node version (2.9 vs 2.14+ changes module behavior).
- Execution mode (ad-hoc, playbook, pull-mode, Tower/AWX workflow).
Output Artifact
Writes to Ansible playbooks YAML, role directory structure, inventory files, Jinja2 templates, and vars files.
Response Format
YAML playbooks/roles with inline configuration. No extraneous explanation.
No preamble. No postamble. No explanations. No filler/hedging/transitions.
Completion Criteria
- Playbook defined with idempotent tasks.
- Inventory configured (static or dynamic).
- Variables externalized in group_vars/host_vars.
- Roles structured per Ansible Galaxy best practices.
- Sensitive data encrypted with ansible-vault.
- Idempotency verified (playbook can be re-run safely).
Max Response Length
Direct file write. No response text.
Architecture Decision Trees
Execution Mode: Ad-hoc vs Playbook vs Pull vs Tower/AWX
| Mode | Use Case | When to Use |
|---|---|---|
| Ad-hoc | Single task, quick check | "Restart service X on all web servers" |
| Playbook | Multi-step orchestration | Full application deployment with pre/post steps |
| Pull mode | Ephemeral nodes, auto-provisioning | Containers, auto-scaling groups, IoT devices |
| Tower/AWX | Enterprise, RBAC, scheduling | >50 nodes, team access, compliance auditing |
Module Choice by Task Type
| Task | Recommended Module | Alternative |
|---|---|---|
| Package install | package (OS-agnostic) |
apt/yum/dnf for OS-specific options |
| File operations | copy, template, lineinfile |
blockinfile for multi-line blocks |
| Service control | service (generic) |
systemd for systemd-specific features |
| Command execution | command (idempotent shell) |
shell when pipes/redirects needed |
| Cloud provisioning | amazon.aws.ec2_instance (collection) |
Raw ec2 module (deprecated) |
| Docker management | community.docker.docker_container |
docker compose module |
| Kubernetes | kubernetes.core.k8s |
helm module for Helm charts |
| Git operations | git |
subversion for SVN repos |
| Database | mysql_db, postgresql_db |
mongo modules |
| Windows | win_package, win_service |
win_command as fallback |
Inventory Source Decision
| Scenario | Best Choice |
|---|---|
| < 50 static servers | INI or YAML inventory files |
| AWS EC2 dynamic | amazon.aws.aws_ec2 inventory plugin |
| GCP Compute | google.cloud.gcp_compute inventory plugin |
| Azure VMs | azure.azcollection.azure_rm inventory plugin |
| VMware vSphere | community.vmware.vmware_vm_inventory |
| Kubernetes pods | kubernetes.core.k8s inventory |
| Mixed cloud/on-prem | Custom script or Tower/AWX smart inventories |
Quick Start
Inventory file with host groups → ansible.cfg for optimization → Playbook with pre_tasks, roles, post_tasks → Encrypt secrets with ansible-vault → Run with ansible-playbook -i inventory site.yml --ask-vault-pass.
Core Workflow
Step 1: Ansible Configuration
# ansible.cfg
[defaults]
inventory = ./inventory/hosts.ini
host_key_checking = False
retry_files_enabled = False
gathering = smart
fact_caching = jsonfile
fact_caching_connection = /tmp/ansible_cache
fact_caching_timeout = 3600
stdout_callback = yaml
callback_whitelist = profile_tasks, timer, mail
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
control_path = /tmp/ansible-%%h-%%p-%%r
Step 2: Inventory Structure
# inventory/hosts.ini
[web]
web-01 ansible_host=10.0.1.10 ansible_user=deploy
web-02 ansible_host=10.0.1.11 ansible_user=deploy
[db]
db-primary ansible_host=10.0.2.10 ansible_user=deploy
db-replica ansible_host=10.0.2.11 ansible_user=deploy
[cache]
redis-01 ansible_host=10.0.3.10 ansible_user=deploy
[production:children]
web
db
cache
[production:vars]
ansible_ssh_private_key_file = ~/.ssh/production_rsa
environment = production
# inventory/hosts.yml — YAML format for complex setups
all:
children:
web:
hosts:
web-01:
ansible_host: 10.0.1.10
web-02:
ansible_host: 10.0.1.11
vars:
http_port: 443
ssl_enabled: true
db:
hosts:
d
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/ansible-advanced.md
- references/ansible-best-practices.md
- references/ansible-fundamentals.md
- references/ansible-roles.md
- references/ansible-security.md
- references/ansible-testing.md
- references/ansible-tower.md
- references/automation-playbooks.md
- references/inventory-config.md
- references/merged-ansible-automation.md
FAQ
Что делает скилл ansible?
Use when the user asks about Ansible playbooks, roles, inventory, ansible-playbook, ansible-galaxy collections, Jinja2 templates, ansible-vault, AWX or Ansible Automation Platform, or idempotent configuration management. Produces idempotent playbooks, roles and CI checks (ansible-lint, Molecule). Not for provisioning cloud resources (use terraform).
Как установить скилл ansible?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ansible запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…