Hi,
With ansible 2.0, should the following use of include_vars give the error
below?
# tree
├── roles
│ └── common
│ ├── tasks
│ │ └── main.yml
│ └── vars
│ ├── Debian.yml
│ └── default.yml
# cat roles/common/tasks/main.yml
- include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}.yml"
- "default.yml"
- package: name={{ bindutils_package }} state=present
# cat roles/common/vars/default.yml
bindutils_package: bind-utils
# cat roles/common/vars/Debian.yml
bindutils_package: dnsutils
# ansible-playbook -i hosts site.yml
PLAY
***************************************************************************
TASK [setup]
*******************************************************************
ok: [127.0.0.1]
TASK [include]
*****************************************************************
included: /tmp/ansible-test/roles/common/tasks/main.yml for 127.0.0.1
TASK [include_vars]
************************************************************
fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "ERROR! No file was
found when using with_first_found. Use the 'skip: true' option to allow
this task to be skipped if no files are found"}
PLAY RECAP
*********************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=1
Using strace, I can see it tries to access /tmp/vars/default.yml. This
seems to be because roledir = None
in lib/ansible/plugins/lookup/first_found.py
roledir = variables.get('roledir')
Is this the expected behaviour or am I using the module incorrectly?
Regards,
Marcus.
--
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/8fb209c7-01a4-4850-a969-0450aa840dcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.