I am referring to the documentation here: http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
When I use vars_files and “-e” (command line) variables together, I get results that appear to fly in the face of the aforementioned documentation. Exhibit A:
`
$ ansible --version
ansible 1.5.3
$ cat test_vars.yml
---
test_var: "from vars_files"
$ cat test.yml
---
- hosts: 127.0.0.1
connection: local
vars_files:
- test_vars.yml
tasks:
- name: Testing variables
debug: msg="{{ test_var }}"
$ ansible-playbook -i test test.yml -e "test_var='from command line'"
PLAY [127.0.0.1] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [Testing variables] *****************************************************
ok: [127.0.0.1] => {
"msg": "from vars_files"
}
PLAY RECAP ********************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0
`
Note that according to the docs, -e variables should “always win” but in this case, they clearly do not. What is the correct precedence as of Ansible 1.5?