Connection problems: Check SSH keys, usernames, and network connectivity
Permission errors: Verify become settings and sudo configuration
Variable errors: Check variable names, scoping, and precedence
Template errors: Validate Jinja2 syntax and variable references
Debugging Commands
# Increase verbosityansible-playbook site.yml -v # verboseansible-playbook site.yml -vv # more verboseansible-playbook site.yml -vvv # very verbose# Check syntaxansible-playbook site.yml --syntax-check# Dry run (don't make changes)ansible-playbook site.yml --check# List tasks that would runansible-playbook site.yml --list-tasks# Test connectivityansible all -m ping -i inventory/hosts.yml
Useful Debug Tasks
# Show variable contents- name: Debug variable debug: var: my_variable# Show multiple variables- name: Debug multiple items debug: msg: "Host {{ inventory_hostname }} has IP {{ ansible_default_ipv4.address }}"# Show all facts- name: Show all gathered facts debug: var: ansible_facts