Interview Prep/Ansible/YAML, Syntax and Jinja2 Errors

`found character '\t' that cannot start any token`

BeginnerTroubleshootingYAML, Syntax and Jinja2 Errors
Answer

Likely causes → A tab character. YAML only allows spaces for indentation. This usually comes from an editor that inserts tabs, or from copy-pasting out of a terminal or a wiki.

Diagnose →

grep -nP '\t' roles/web/tasks/main.yml
cat -A roles/web/tasks/main.yml | grep '\^I'

Fix → Replace the tabs with spaces: sed -i 's/\t/ /g' file.yml, then re-check the indentation.

Prevent → Add an .editorconfig with indent_style = space for *.yml, and run yamllint in CI.

All Ansible questions Roadmap: Ansible

More on YAML, Syntax and Jinja2 Errors