# Possible Documentation Error (or bug) Regarding --extra-vars

**URL:** <https://forum.ansible.com/t/possible-documentation-error-or-bug-regarding-extra-vars/13903>\
**Category:** Ansible Project\
**Created:** [November 13, 2013, 11:05pm UTC](https://forum.ansible.com/t/possible-documentation-error-or-bug-regarding-extra-vars/13903 "2013-11-13T23:05:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Szewczyk](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@Rob\_Szewczyk](https://forum.ansible.com/u/Rob_Szewczyk)\
**Post date:** [November 13, 2013, 11:05pm UTC](https://forum.ansible.com/t/possible-documentation-error-or-bug-regarding-extra-vars/13903/1 "2013-11-13T23:05:00Z")

</div>

Using Ansible 1.3.4

According to the [docs](http://www.ansibleworks.com/docs/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable), this is the precedence:

```auto
* -e variables always win
* then comes "most everything else"
* then comes variables defined in inventory
* then "role defaults", which are the most "defaulty" and lose in priority to everything.

```

I am finding this is true except in the case of of variables imported via vars\_files. So given the following play in a playbook someplay.yml:

```auto
---
- hosts: all
  remote_user: root
  vars:
    favcolor: blue
  vars_files:
    - /vars/external_vars.yml
  tasks:
  - name: this is just a placeholder
    command: /bin/echo foo

```

And the following in /vars/external\_vars.yml:

```auto
---
favfood: pizza

```

And I invoke the playbook with:

```auto
ansible-playbook someplay.yml -e '{"favfood":"bacon","favcolor":"bacon"}'

```

I end up with favfood=pizza, favcolor=bacon. The actual order is:

1. variables in external files that are referenced with vars\_files
2. -e
3. everything else (playbook vars, roles/vars, inventory vars, roles/defaults, etc…)

There is a closed issue [here](https://github.com/ansible/ansible/issues/2713?source=cc) that seems to indicate that this behavior is correct and that the documentation is wrong. However the issue is from some time ago - so which is it now?
