Is this a bug or am I misunderstanding how variables are resolved based on precedence? According to http://docs.ansible.com/playbooks_variables.html,
* extra vars (-e in the command line) always win * then comes connection variables defined in inventory (ansible_ssh_user, etc) * then comes "most everything else" (command line switches, vars in play, included vars, role vars, etc) * then comes the rest of the variables defined in inventory * then comes facts discovered about a system * then "role defaults", which are the most "defaulty" and lose in priority to everything.
The setup
robin@hood:~/AnsiblePlaybooks/ExtraVars$ tree
±- extravars.yml
±- inventory
±- roles
±- testextravars
±- tasks
¦ ±- main.yml
±- vars
±- extravars.json
±- main.yml
# The playbook
robin@hood:~/AnsiblePlaybooks/ExtraVars$ cat extravars.yml