SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Ansible 10 errors

Ansible Playbook & Connection Errors

Unreachable hosts, become passwords, undefined variables and Jinja2 failures.

Understanding Ansible errors

Ansible errors split cleanly between transport problems (it cannot reach or authenticate to the host) and execution problems (it reached the host but the play failed). The message header tells you which: UNREACHABLE! is transport, FAILED! is execution. Transport issues are SSH issues wearing an Ansible hat and should be debugged with plain ssh first.

How to debug Ansible errors

  1. Run ansible -m ping all before running any playbook. It isolates connectivity and privilege escalation from your task logic.
  2. Raise verbosity progressively: -v shows results, -vvv shows the SSH command line, -vvvv shows connection debugging. Most unreachable errors are solved at -vvv.
  3. Use --check --diff to see what a play would change without changing it. This turns a destructive debugging loop into a safe one.
  4. For undefined-variable errors, dump the actual scope with a debug task (var: hostvars[inventory_hostname]) rather than reasoning about precedence from the docs.
  5. Remember variable precedence order: extra vars (-e) beat everything, role defaults lose to everything. Surprising values are nearly always a precedence surprise.

Tools worth reaching for

  • ansible -m ping
  • ansible-playbook --check --diff
  • ansible-lint
  • ssh -vvv

All 10 Ansible errors

Other categories