Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Ansible Pro

ASecurity

Ansible guidance — inventory, playbooks, roles, idempotency, vault secrets, and reliable automation at scale.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentsgoshellbashnodeterraformapiperformance

Works with

api

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill ansible-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ansible Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Ansible Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-ansible-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-ansible-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: ansible-pro
description: Ansible guidance — inventory, playbooks, roles, idempotency, vault secrets, and reliable automation at scale.
category: development
---

## Overview

Ansible automates servers over SSH without agents: you describe desired state in YAML playbooks, and Ansible's modules converge machines toward it. It's the pragmatic choice for configuring VMs, deploying to bare metal, and gluing together infrastructure that isn't fully cloud-native.

Ansible's simplicity is deceptive — at scale, playbook design (roles, idempotency, inventory structure) determines whether automation is reliable or a source of outages. This skill covers writing idempotent playbooks, organizing roles and inventory, handling secrets with Vault, and running Ansible safely against production.

## When to use

- Automating server configuration (packages, files, services).
- Writing idempotent playbooks and roles.
- Structuring inventory for multiple environments.
- Managing secrets with Ansible Vault.
- Deploying applications to VMs or bare metal.
- Running Ansible at scale (performance, strategies, pull mode).
- Choosing between Ansible, Terraform, Chef/Puppet, or cloud-init.

## Core concepts

- **Idempotency is the contract.** Running a playbook twice should produce the same result as running it once. Use modules (not shell commands) — `apt`, `copy`, `template`, `systemd` are idempotent; `shell: apt-get install` is not. Test by running twice and expecting zero changes the second time.
- **Inventory.** Hosts and groups in INI/YAML or dynamic inventory scripts (cloud providers). Group variables layer: `group_vars/all`, `group_vars/webservers`, `host_vars/` — most-specific wins. Keep environments as separate inventories or directories.
- **Playbooks.** Ordered plays mapping hosts to roles/tasks. Keep plays focused; one playbook per purpose beats a mega-playbook with conditionals everywhere.
- **Roles.** Reusable units (`tasks/`, `handlers/`, `templates/`, `defaults/`, `vars/`, `meta/`). `defaults/` are overridable; `vars/` are not — put user-configurable values in defaults. Roles from Galaxy are starting points, not gospel — vet them.
- **Handlers.** Restart/reload services only when notified by changed tasks. Handlers run once at the end of the play — the mechanism that makes config changes safe and non-disruptive when nothing changed.
- **Templates.** Jinja2 templates for config files with variables, loops, and conditionals. Validate rendered configs (`validate:` on template/copy) — a bad nginx.conf that fails validation never gets installed.
- **Vault.** Encrypt secrets (`ansible-vault encrypt_string`, vault files) with passwords from files/scripts/CI, never typed interactively in automation. Separate vault passwords per environment.
- **Check mode and diff.** `--check --diff` previews changes without applying — the plan/apply equivalent. Run it before production changes; treat unexpected diffs as a stop signal.
- **Tags.** Tag tasks/roles for selective runs (`--tags`, `--skip-tags`). Essential for large playbooks when you need to run just the app deploy without touching the base config.
- **Facts.** Ansible gathers host facts automatically (OS, IPs, memory) — use them for conditional logic instead of hardcoding per-host values. Disable fact gathering (`gather_facts: no`) for speed when you don't need them.
- **Delegation and run_once.** `delegate_to: localhost` for control-node tasks (API calls, local builds); `run_once` for cluster-singleton operations (DB migrations). Getting this wrong runs migrations N times.
- **Strategies.** `linear` (default, lockstep) vs `free` (hosts proceed independently, faster at scale). For rolling deploys, `serial` batches hosts — the rolling-update primitive.
- **Become (privilege escalation).** `become: yes` for root tasks; scope it per task, not globally — least privilege applies to automation too.
- **Dynamic inventory.** Cloud inventory plugins query the provider for hosts — no static host files drifting out of date. Tag-based grouping keeps it organized.
- **Ansible vs Terraform.** Ansible configures machines; Terraform provisions infrastructure. They complement: Terraform creates the servers, Ansible configures them (or use cloud-init/user-data for immutable approaches).

## Practical workflow

1. **Structure the project.** Inventories per environment, roles per component, playbooks per operation.
   ```
   ansible/
     inventories/prod/hosts.yml  inventories/staging/hosts.yml
     group_vars/all.yml          group_vars/webservers.yml
     roles/app/{tasks,handlers,templates,defaults}/
     site.yml  deploy-app.yml
   ```
2. **Write idempotent tasks.** Modules over shell; `creates:`/`removes:` guards when shell is unavoidable; notify handlers for restarts.
   ```yaml
   - name: Deploy app config
     template:
       src: app.conf.j2
       dest: /etc/app/app.conf
       validate: /usr/sbin/app --check-config %s
     notify: Restart app
   ```
3. **Template configs with validation.** Jinja2 for dynamic config; `validate:` commands prevent installing broken configs; handlers restart services once.
4. **Encrypt secrets with Vault.** `ansible-vault encrypt_string` for inline secrets, vault files for bundles; per-environment vault passwords from a secure source in CI.
   ```bash
   ansible-vault encrypt_string 'db_password' --name 'db_password'
   ansible-playbook site.yml --vault-password-file .vault-pass-prod
   ```
5. **Preview with check mode.** `ansible-playbook site.yml --check --diff --limit staging` before touching production; investigate every unexpected change.
6. **Roll with serial.** `serial: 2` (or percentages) for rolling restarts; `max_fail_percentage` to abort a bad rollout early.
   ```yaml
   - hosts: webservers
     serial: "25%"
     max_fail_percentage: 25
     roles: [app]
   ```
7. **Limit blast radius.** `--limit` for canary hosts first, then expand; separate inventories per environment so prod is never an accident away.
8. **Run reliably in CI.** Pin Ansible version (collections included via `requirements.yml`), vault passwords from CI secrets, `--diff` output in logs, and idempotency checks (second run shows zero changes).

## Common pitfalls

- **Non-idempotent tasks** — shell commands that change things every run; use modules, test with double runs.
- **Vault passwords in the repo** — committed vault password files; source them from CI secrets or a password manager.
- **Running against prod by accident** — one inventory, no `--limit` discipline; separate inventories and canary limits.
- **Handlers that never fire** — `notify` name mismatches (case-sensitive); handlers silently skipped.
- **Unvalidated templates** — broken configs installed and services failing; always `validate:` service configs.
- **Shell instead of modules** — `command: systemctl restart` instead of the `systemd` module; loses idempotency and error handling.
- **Global `become: yes`** — everything as root; scope privilege escalation per task.
- **Forgetting `run_once`/`delegate_to`** — migrations or API calls running per-host; singleton operations need explicit scoping.
- **Unpinned collections** — Galaxy updates breaking playbooks; pin versions in `requirements.yml`.
- **No check-mode preview** — applying blind to production; `--check --diff` first, always.
- **Serial-less restarts** — restarting all web servers simultaneously; `serial` for rolling changes.
- **Facts gathering overhead** — slow runs from unneeded facts; `gather_facts: no` when unused.
- **Secrets in plaintext vars** — passwords in `group_vars`; vault-encrypt anything sensitive.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →