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.