Interview Prep/Ansible/Variables, Facts and Precedence Problems

`ERROR! Invalid extra vars data supplied. 'vars/prod.yml' could not be made into a dictionary`

BeginnerTroubleshootingVariables, Facts and Precedence Problems
Answer

Likely causes → The file path was passed without @. -e vars/prod.yml is read as an inline string, not as a file.

Fix →

ansible-playbook site.yml -e @vars/prod.yml

Also check that the file's top level is a mapping, not a list.

Prevent → Wrap the call in a Makefile or CI template so the flags stay consistent.

All Ansible questions Roadmap: Ansible

More on Variables, Facts and Precedence Problems