I believe it is a bug, but since I am an ansible beginner I would like to 
check with someone before reporting - either for comfirmation or some 
indication that I am doing it the wrong way:

I am trying to load some variables from files in a role. The names of files 
are stored in a variable, in the same role. Thing is, I try to run the 
include_vars as a local_action.

*roles/common/vars/main.yml:*
x:
  - aaa
  - bbb


*roles/common/tasks/main.yml:*
- name: include vars w/ local_action
  local_action: include_vars "{{item}}.yml"
  with_items: "{{x}}"


*site.yml:*
- name: common stuff
  hosts: all
  gather_facts: no
  roles:
    - common


This should, afaik, load the variables defined in files 
roles/common/vars/aaa.yml and roles/common/vars/bbb.yml. But when I run
ansible-playbook site.yml the files are searched in ./ instead of in 
roles/common/vars:

TASK [common: include vars w/ local_action] *********************
task path: /home/ansible/roles/dsv/tasks/main.yml:12
failed: [my.host -> localhost] => (item=aaa) => {"failed": true, "file": 
"/home/ansible/aaa.yml", "invocation": {"module_args": {"_raw_params": 
"\"aaa.yml\""}, "module_name": "include_vars"}, "item": "aaa", "msg": 
"Source file not found."}

Is this an expected behaviour or a bug, taking into account that when I do 
the include_vars without the local_action everything works fine?

BTW, the above example is a test case I made to show the problem in a 
simple way. This error showed up in a real use case a lot more complex. I 
am using ansible 2.0.0.

Thanks in advance.


Paulo Suderio


-- 
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/e867fcfc-d282-4e34-ba92-11780b10cf93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to