Skip to content

Common failures

The three most common failures are treating YAML as code, hardcoding secrets and reaching for shell when a native module exists.

The first failure is treating YAML as a programming language. Loops, conditionals and error handling exist, but they are deliberately limited. When a playbook needs real logic, the right answer is a custom module, not a 400-line block of Jinja2 conditionals.

The second failure is hardcoding secrets. Passwords in group_vars/*.yml end up in git, then in backups, then in someone's laptop. Ansible Vault, HashiCorp Vault via the community.hashi_vault collection, or external secret managers are the correct place.

The third failure is bypassing modules with command or shell. Both run any binary, both are non-idempotent by default, and both bypass Ansible's change detection. They are legitimate for one-off migrations; they are not legitimate for persistent configuration.

A fourth, subtler failure is version drift. Ansible-core releases frequently, collections release independently, and a playbook that worked in 2023 may fail in 2025 because a module changed its return schema. Pinning versions in requirements.yml is the mitigation.