Upgrading into 1.8.2 (from 1.6.x) produces the same behaviour for me.

I use:

  vars_files:
    - "vars/DEFAULTS.yml"
    - "vars/{{ansible_system}}.yml"
    - ["vars/{{ansible_distribution}}.yml", "vars/empty.yml"]
    - 
["vars/{{ansible_distribution}}_{{ansible_distribution_major_version}}.yml", 
"vars/empty.yml"]

and it is not loading the correct files anymore, it loads just the 
"vars/{{ansible_system}}.yml" and that's it.

On Wednesday, January 14, 2015 at 4:03:19 AM UTC+2, Aliaksei Ilkiu wrote:
>
> I have a variable ourenv that defines specific environment. This variable 
> is defined in inventory file a used to load environment specific values via 
> vars_files as demonstrated in 
> https://gist.github.com/marktheunissen/2979474
> After upgrade to 1.8.0 I'm facing problem with loading environment 
> specific properties via - [] syntax
>
> *Sample site.yml*
>
> ---
> - name: CheckIt
>   hosts: all
>   sudo: yes
>   gather_facts: yes
>   vars_files:
>   - ['vars/env_{{ourenv}}.yml', vars/env_defaults.yml]
>   tasks:
>   - name: debug
>     debug: msg="ourenv {{ ourenv }} pg_wal_buffers {{ pg_wal_buffers }}"
>
>
> *Sample inventory file*
>
> [singlebox]
> localbox ourenv=dev_single host=devsrv ansible_ssh_host=192.168.18.129 
> alias=dev
>
>
> *Sample vars/env_dev_single.yml*
>
> pg_wal_buffers: 4MB
>
>
> *Sample vars/env_defaults.yml*
>
> pg_wal_buffers: value
>
>
> *Output in 1.8.X/1.9 (UNEXPECTED)*
>
> PLAY [CheckIt] 
> **************************************************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [localbox]
>
> TASK: [debug] 
> ***************************************************************** 
> ok: [localbox] => {
>     "msg": "ourenv dev_single pg_wal_buffers value"
> }
>
>
> *Output in 1.4.X/.../1.7.2 (CORRECT)*
>
> PLAY [CheckIt] 
> **************************************************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [localbox]
> localbox: importing /bla-bla-bla/vars/env_dev_single.yml
>
> TASK: [debug] 
> ***************************************************************** 
> ok: [localbox] => {
>     "msg": "ourenv dev_single pg_wal_buffers 4MB"
> }
>
>
> It seams to me that no issues with loading these variables directly if I 
> replace - ['vars/env_{{ourenv}}.yml', vars/env_defaults.yml] with - 
> 'vars/env_{{ourenv}}.yml' but I want to have 'failback to defaults' 
> option. 
> Also if I pass ourenv via command line (-e "ourenv=dev_single") it works 
> as expected but I think it's bad practice (splitting environment knowledge 
> between inventory file and command line arguments).
>
> Can somebody point me to the right direction?
>
> I also opened ticket https://github.com/ansible/ansible/issues/10000 but 
> hope to get faster response here.
>

-- 
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/e4550ee5-e603-4cb6-a0e1-d03b0fe9c832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to