ansible-idempotency

Make Ansible command and shell tasks idempotent with changed_when and failed_when.

1|Updated Oct 12, 2025
One-click install
npx skills add https://github.com/basher83/Virgo-Core --skill ansible-idempotency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ansible-idempotency
Source: https://github.com/basher83/Virgo-Core/tree/main/.claude/plugins/ansible-workflows/skills/ansible-idempotency
Command: npx skills add https://github.com/basher83/Virgo-Core --skill ansible-idempotency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, and includes scripts (resource) components.

What problem does it solve?

This Skill solves the problem of Ansible playbooks reporting "changed" when no actual state change occurred, or failing unexpectedly. It ensures your automation is reliable and predictable, saving time by preventing unnecessary re-runs and false positives.

Core Features & Use Cases

  • Precise Change Detection: Master changed_when and failed_when to accurately report task outcomes, especially for command and shell modules.
  • Check-Before-Create Patterns: Implement robust logic to verify resource existence before attempting creation, preventing errors and ensuring idempotency.
  • Robust Shell Scripting: Learn to use set -euo pipefail for safer, more predictable shell commands within Ansible.
  • Use Case: You have an Ansible task that creates a Proxmox API token. Use this skill to ensure the task only reports "changed" if the token was actually created, and doesn't fail if it already exists.

Quick Start

"Explain how to make an Ansible command task idempotent when creating a user, ensuring it only reports 'changed' if the user was actually created and doesn't fail if the user already exists."