# Ansible 2 multiple extra vars files

**URL:** <https://forum.ansible.com/t/ansible-2-multiple-extra-vars-files/20445>\
**Category:** Ansible Project\
**Created:** [February 4, 2016, 6:31am UTC](https://forum.ansible.com/t/ansible-2-multiple-extra-vars-files/20445 "2016-02-04T06:31:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Olliver2](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@Mark\_Olliver2](https://forum.ansible.com/u/Mark_Olliver2)\
**Post date:** [February 4, 2016, 6:31am UTC](https://forum.ansible.com/t/ansible-2-multiple-extra-vars-files/20445/1 "2016-02-04T06:31:51Z")

</div>

Hi

When running a playbook via Ansible-playbook with the --extra-vars flag I can supply the argument multiple times and all the vars get combined.

My question is what is the order of inheritance within the files if I were to supply the same car in both. For example may be I have a default set of override vars I use all the time but then for certain environments I override the domain var. would the first file in the supplied list trump or the last and is it consistent?

Thanks

Mark

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 4, 2016, 3:28pm UTC](https://forum.ansible.com/t/ansible-2-multiple-extra-vars-files/20445/2 "2016-02-04T15:28:03Z")

</div>

It is not really inheritance as the files are unrelated to each other,  
but as the vars get created they can be overwritten or merged  
(ansible.cfg setting should apply) by the 'next file', so the last  
file listed should win and it is consistent (same order same results).

---

<div class="post-metadata">

**Author:** ![Arthur\_Reyes](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Arthur\_Reyes](https://forum.ansible.com/u/Arthur_Reyes)\
**Post date:** [March 1, 2016, 9:36pm UTC](https://forum.ansible.com/t/ansible-2-multiple-extra-vars-files/20445/3 "2016-03-01T21:36:26Z")

</div>

I have been experimenting with using multiple instances of extra-vars at the command line and I have observed that last in from the command line is the value used at execution time.

ansible-playbook --extra-vars “foo=‘Yes’” --extra-vars “foo=‘No’” would pass foo=‘No’ to your playbook. The name space is overwritten every time it is declared.
