# Include + Vars = Unexpected Behaviour?

**URL:** <https://forum.ansible.com/t/include-vars-unexpected-behaviour/17937>\
**Category:** Ansible Project\
**Created:** [April 9, 2015, 8:40am UTC](https://forum.ansible.com/t/include-vars-unexpected-behaviour/17937 "2015-04-09T08:40:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Auth](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Christian\_Auth](https://forum.ansible.com/u/Christian_Auth)\
**Post date:** [April 9, 2015, 8:40am UTC](https://forum.ansible.com/t/include-vars-unexpected-behaviour/17937/1 "2015-04-09T08:40:49Z")

</div>

Hey,

i am working on a infrastructure that is completely managed by ansible (great tool btw). we are currently in the process of adding different environments (production, prelive …) and we hit a problem that i need help with to understand whats going wrong here.

we have a group\_vars file “all” which contains most of the configuration and then each role / environment overrides any needed variables via it’s hostfile or a custom yml provided via -e on the command line.

group\_vars/all:

search\_domain: [search.example.com](http://search.example.com)  
search\_domains:

- { domain : ‘[search.example.com](http://search.example.com)’, aliases : }

custom.yml (which is loaded via -e on the command line)

search\_domain: [prelive.search.example.com](http://prelive.search.example.com)  
search\_domains:

- { domain : ‘[prelive.search.example.com](http://prelive.search.example.com)’, aliases : }

As far is understand variable precedence the custom.yml values are overriding the values from all. this is somewhat wokring as intended.  
Now come the thing i don’t seem to understand. Given this playbook:
