vars_files not importing existing file

Hi,

I create an issue in the ansible github and Michael DeHaan recomend me to ask here for help.

All the information is in this issue:
https://github.com/ansible/ansible/issues/7901

The summary is:

In Ubuntu 12.04. versions 1.5.4, 1.5.5, 1.6.0 and 1.6.1, a “vars_files” section defined like the following example do not find the file to include (in the example Ubuntu.yml). But the os_defaults.yml file is imported correctly.
The same example used with versions older or equal than 1.5.3 and versions 1.6.2 and 1.6.3 works correctly.

---
- hosts: all
  vars_files:
  - - {{ ansible_distribution }}.yml
    - os_defaults.yml

  tasks:
  - debug: msg="{{some_var}}"

This is the message of the “incorrect” versions:

158.42.105.25: not importing file: /home/ubuntu/{{ansible_distribution}}.yml

This is the message of the “correct” versions:

158.42.105.25: importing /home/ubuntu/Ubuntu.yml

Any ideas?

Thanks in advance.

" - - {{ ansible_distribution }}.yml

    - os_defaults.yml"

This looks like a formatting error to me.

vars_files:
   - [ "{{ ansible_os_distribution }}.yml", "os_defaults.yml" ]

OR:

Hi,

The format I show in the example is the output obtained by the dump function of the PyYAML library, so I suppose that is a correct YAML format.
Anyway I tested with these formats and all of them get the same result.
With versions 1.5.4, 1.5.5, 1.6.0 and 1.6.1 it does not work and with versions older or equal than 1.5.3 and versions 1.6.2 and 1.6.3 it works correctly.

Best regards.

I’ve never seen that variation before, interesting.

Ok, we’ll reopen this and verify that we do have an integration test for conditional vars_files.