Ansible 2.1 - Dynamic vars_files and "skipping vars_file" output messages with -vvv

322 views
Skip to first unread message

digi691

unread,
Jul 6, 2016, 11:39:50 AM7/6/16
to Ansible Project
Hello,

While trying to move over to Ansible 2.1 from 1.9.2, I've noticed Ansible having a lot of output about skipping vars_file when I pass "-vvv" to ansible-playbook.  I'm including 3 vars_file(s) using variable substitution.  I've looked in the projects reported bugs and checked the mailing list with no one describing or reporting this behavior.  Below is an example of what I'm doing:

---

- hosts: all
  user: root
  vars_files:
    - var_files/{{ ansible-distribution }}.yml
    - var_files/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml
    - var_files/{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml
  roles:
    - blah

I'm getting the skipping vars_file message about 150+ times before the PLAYBOOK output line, with additional messages after the PLAYBOOK line, PLAY [all] line, Task SETUP line, and after my last task plays.  The odd thing is that when I test the variables and their precedence that are in the appropriate files, I'm getting the correct variables.  So it seems that it is actually reading the var_files appropriately regardless of the messages and no confirmation messages that they were actually included/read at some point.  Should I report this as a bug to the Ansible project or is this method no longer the "supported" way to include dynamic vars_file(s)?  I've come up with a workaround to avoid these messages which is below.  Guidance on the situation and whether this is actually a bug or not is appreciated.

---

- hosts: all
  user: root
  pre_tasks:
    - include_vars: 'var_files/{{ ansible-distribution }}.yml'
      tags: always
    - include_vars: 'var_files/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
      tags: always
    - include_vars: 'var_files/{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
      tags: always
  roles:
    - blah


Thanks,

Chris
Reply all
Reply to author
Forward
0 new messages