{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/33131","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/33131/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/33131/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/33131/events","html_url":"https://github.com/ansible/ansible/issues/33131","id":275674973,"number":33131,"title":"include_role: Cannot find tasks files in 'include_tasks' statement of included role","user":{"login":"johnreed00","id":14803828,"avatar_url":"https://avatars3.githubusercontent.com/u/14803828?v=4","gravatar_id":"","url":"https://api.github.com/users/johnreed00","html_url":"https://github.com/johnreed00","followers_url":"https://api.github.com/users/johnreed00/followers","following_url":"https://api.github.com/users/johnreed00/following{/other_user}","gists_url":"https://api.github.com/users/johnreed00/gists{/gist_id}","starred_url":"https://api.github.com/users/johnreed00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnreed00/subscriptions","organizations_url":"https://api.github.com/users/johnreed00/orgs","repos_url":"https://api.github.com/users/johnreed00/repos","events_url":"https://api.github.com/users/johnreed00/events{/privacy}","received_events_url":"https://api.github.com/users/johnreed00/received_events","type":"User","site_admin":false},"labels":[{"id":562292166,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.4","name":"affects_2.4","color":"ededed","default":false},{"id":785271699,"url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":705713566,"url":"https://api.github.com/repos/ansible/ansible/labels/include_role","name":"include_role","color":"d93f0b","default":false},{"id":636352796,"url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-21T11:19:57Z","updated_at":"2018-03-21T19:09:10Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nVerify first that your issue/request is not already reported on GitHub.\r\nAlso test if the latest release, and master branch are affected too.\r\n-->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Name of the module/plugin/task/feature -->\r\ninclude_role\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.4.0.0\r\n  config file = /usr/local/etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say \"N/A\" for anything that is not platform-specific.\r\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.\r\n-->\r\nFreeBSD-11.1-RELEASE\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nCannot find tasks files from 'include_tasks' statement of included role \r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used.\r\n-->\r\nWhen I include a role from another role, the include statement of the included role is not able to find the file. For example:\r\n\r\nRole A includes role B\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- name: Include other role\r\n  include_role:\r\n    name: roleB\r\n```\r\nand role B is split into multiple task files:\r\n```yaml\r\n- name: Install\r\n  include_tasks: install.yml\r\n\r\n- name: Configure\r\n  include_tasks: configure.yml\r\n```\r\nWhen role B is directly used from a play everything works fine, but using it from task A failed with 'file not found errors'.\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nTASK [jails : include_tasks] **********************************************************************************************************************************************************************************\r\nfatal: [domain.local]: FAILED! => {\"failed\": true, \"reason\": \"Unable to retrieve file contents\\nCould not find or access '/data/home/ansible/svn/esmg/cfg/unixadm/jails.yaml'\"} \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/375061904","html_url":"https://github.com/ansible/ansible/issues/33131#issuecomment-375061904","issue_url":"https://api.github.com/repos/ansible/ansible/issues/33131","id":375061904,"user":{"login":"jeffwils","id":14326407,"avatar_url":"https://avatars0.githubusercontent.com/u/14326407?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffwils","html_url":"https://github.com/jeffwils","followers_url":"https://api.github.com/users/jeffwils/followers","following_url":"https://api.github.com/users/jeffwils/following{/other_user}","gists_url":"https://api.github.com/users/jeffwils/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffwils/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffwils/subscriptions","organizations_url":"https://api.github.com/users/jeffwils/orgs","repos_url":"https://api.github.com/users/jeffwils/repos","events_url":"https://api.github.com/users/jeffwils/events{/privacy}","received_events_url":"https://api.github.com/users/jeffwils/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T19:09:10Z","updated_at":"2018-03-21T19:09:10Z","author_association":"NONE","body":"This issue also occurs if even when the role is invoked directly from the playbook and the include_tasks is being invoked within a with_items loop.\r\n\r\nPlaybook\r\n```yaml\r\n- hosts: all\r\n  vars:\r\n     mylist:\r\n         - val1\r\n         - val2\r\n  roles: \r\n     - myrole\r\n```\r\n\r\nmyrole/main.yml\r\n```yaml\r\n- name: my looped task\r\n  include_tasks: mysubtask.yml myvar = item\r\n  with_items: mylist\r\n```\r\n\r\nmyrole/mysubtask.yml\r\n\r\n```yaml\r\n- debug:\r\n     msg: \"Calling this with {{ myvar }}\"\r\n```\r\n\r\nOutput\r\n```\r\nPLAY [local] *************************************************************************************************************************************************************************************************************************************\r\n\r\nTASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************\r\nok: [localhost]\r\n\r\nTASK [myrole : my looped task] *******************************************************************************************************************************************************************************************************************\r\nfatal: [localhost]: FAILED! => {\"failed\": true, \"reason\": \"Unable to retrieve file contents\\nCould not find or access '/Users/jeffwils/development/ansible/playbooks/mysubtask.yml myvar = item'\"}\r\n\tto retry, use: --limit @/Users/jeffwils/development/ansible/playbooks/myplaybook.retry\r\n\r\nPLAY RECAP ***************************************************************************************************************************************************************************************************************************************\r\nlocalhost                  : ok=1    changed=0    unreachable=0    failed=1\r\n```"}}
{"actor":{"display_login":"jeffwils"}}