Include + Vars = Unexpected Behaviour?

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
search_domains:

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

search_domain: prelive.search.example.com
search_domains:

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: