Hi,
Consider I have the following structure under a current directory:
`
.
playbook.yml
├── roles
│ ├── common
│ │ ├── defaults
│ │ ├── files
│ │ ├── handlers
│ │ ├── tasks
│ │ ├── templates
│ │ └── vars
`
The playbook.yml includes a playbook from the common role like this:
`
- hosts: “{{ hosts }}”
tasks: - include: roles/common/tasks/task.yml
`
This task from the role installs template on the target host as follows:
`
- template: src=file.j2 dest=/usr/local/etc/file owner=root group=root mode=0644
`
This worked without issues on 1.9.4. Now after upgrade to 2.1.6 I get an error:
fatal: [IP]: FAILED! => {"changed": false, "failed": true, "msg": "IOError: [Errno 2] No such file or directory: u'/current/directory/path/file.j2'"}
So, looks like something has changed in the way Ansible looks for files referenced by an included task. It used to look inside the role’s directory where the task was included from but now it searches in the local directory where the calling playbook is executed from.
This looks counter intuitive and prevents from role tasks being re-used in other playbooks outside the role itself.
Is this a bug or know regression in 2.1.x or “works by design”? Is this happening in 2.1.x only?
Thanks,
Igor