{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/9551","labels_url":"https://api.github.com/repos/ansible/ansible/issues/9551/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/9551/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/9551/events","html_url":"https://github.com/ansible/ansible/issues/9551","id":48633853,"number":9551,"title":"Lookup plugin 'template' doesn't search the same paths as 'file'","user":{"login":"pinkeen","id":2019132,"avatar_url":"https://avatars.githubusercontent.com/u/2019132?v=3","gravatar_id":"","url":"https://api.github.com/users/pinkeen","html_url":"https://github.com/pinkeen","followers_url":"https://api.github.com/users/pinkeen/followers","following_url":"https://api.github.com/users/pinkeen/following{/other_user}","gists_url":"https://api.github.com/users/pinkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/pinkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pinkeen/subscriptions","organizations_url":"https://api.github.com/users/pinkeen/orgs","repos_url":"https://api.github.com/users/pinkeen/repos","events_url":"https://api.github.com/users/pinkeen/events{/privacy}","received_events_url":"https://api.github.com/users/pinkeen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P2","name":"P2","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-11-13T13:07:47Z","updated_at":"2015-06-15T09:15:11Z","closed_at":null,"body":"### Ansible Version\r\n```\r\n± % pip show ansible                                                                                                                                                                                                                          !3182\r\n---\r\nName: ansible\r\nVersion: 1.7.2\r\nLocation: /usr/lib/python2.7/site-packages\r\nRequires: paramiko, jinja2, PyYAML, setuptools, pycrypto\r\n```\r\n### The problem\r\nFile lookup plugin searches for file in the playbook directory and in the role's files directory.\r\n\r\nWhen using the template plugin the playbook directory isn't searched and lookup returns empty string if file is not found.\r\n\r\n`{{ lookup('file', 'config/test.j2') }}` - returns the file contents\r\n`{{ lookup('template', 'config/test.j2') }}` - return empty string\r\n`{{ lookup('template', '/home/somebody/project/config/test.j2') }}` - absolute path works as expected\r\n\r\nThe dir structure is \r\n```\r\nproject/\r\n  * group_vars/\r\n    * some_group.yml - this group sets the variable via lookup\r\n  * roles/\r\n    * the_actual_role_that_uses_the_variable/\r\n    ...\r\n  * config/\r\n    * test.j2\r\n  * playbook.yml\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/111988446","html_url":"https://github.com/ansible/ansible/issues/9551#issuecomment-111988446","issue_url":"https://api.github.com/repos/ansible/ansible/issues/9551","id":111988446,"user":{"login":"sebastianneubauer","id":6823988,"avatar_url":"https://avatars.githubusercontent.com/u/6823988?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastianneubauer","html_url":"https://github.com/sebastianneubauer","followers_url":"https://api.github.com/users/sebastianneubauer/followers","following_url":"https://api.github.com/users/sebastianneubauer/following{/other_user}","gists_url":"https://api.github.com/users/sebastianneubauer/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastianneubauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastianneubauer/subscriptions","organizations_url":"https://api.github.com/users/sebastianneubauer/orgs","repos_url":"https://api.github.com/users/sebastianneubauer/repos","events_url":"https://api.github.com/users/sebastianneubauer/events{/privacy}","received_events_url":"https://api.github.com/users/sebastianneubauer/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T09:15:11Z","updated_at":"2015-06-15T09:15:11Z","body":"@bennojoy : thanks, \"playbook_dir\" seems to work! Do you know by chance, if this is somewhere documented or is it an implementation detail which might change in future versions without notice? "}}