vars_files not importing existing file

54 views
Skip to first unread message

mic...@gmail.com

unread,
Jun 24, 2014, 12:21:32 PM6/24/14
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Jun 24, 2014, 3:39:01 PM6/24/14
to ansible...@googlegroups.com
" - - {{ ansible_distribution }}.yml
    - os_defaults.yml"

This looks like a formatting error to me.

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

OR:
vars_files:
     - "{{ ansible_os_distribution }}.yml"
     - "os_defaults.yml"






--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/841f61e2-dcc7-4f61-84e1-9aff798623f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mic...@gmail.com

unread,
Jun 25, 2014, 3:24:49 AM6/25/14
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Jun 25, 2014, 8:09:13 PM6/25/14
to ansible...@googlegroups.com
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.




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages