The correct precedence is that "-e" should win. So please file a github ticket on github.com/ansible/ansible so we can see about fixing it.
Thanks! On Tue, Mar 25, 2014 at 6:41 PM, Garrett Plasky <[email protected]>wrote: > 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? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/7c7d786f-6ae5-48f9-907e-1d66df8fcfb0%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/7c7d786f-6ae5-48f9-907e-1d66df8fcfb0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEVJ8QP4FHto6juxLHtSf-kRH_JfCCbT9X3Fzk8WbS%2Bug6hGzQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
