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."