{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5166","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5166/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5166/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5166/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/5166","id":181218773,"number":5166,"title":"include_role module silently ignores missing tasks file","user":{"login":"stepanstipl","id":3027227,"avatar_url":"https://avatars.githubusercontent.com/u/3027227?v=3","gravatar_id":"","url":"https://api.github.com/users/stepanstipl","html_url":"https://github.com/stepanstipl","followers_url":"https://api.github.com/users/stepanstipl/followers","following_url":"https://api.github.com/users/stepanstipl/following{/other_user}","gists_url":"https://api.github.com/users/stepanstipl/gists{/gist_id}","starred_url":"https://api.github.com/users/stepanstipl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stepanstipl/subscriptions","organizations_url":"https://api.github.com/users/stepanstipl/orgs","repos_url":"https://api.github.com/users/stepanstipl/repos","events_url":"https://api.github.com/users/stepanstipl/events{/privacy}","received_events_url":"https://api.github.com/users/stepanstipl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-05T17:36:22Z","updated_at":"2016-10-05T17:36:22Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\ninclude_role\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.3.0 (devel b233f3ed3c) last updated 2016/10/05 16:30:35 (GMT +100)\r\n  lib/ansible/modules/core: (detached HEAD 0ee774ff15) last updated 2016/10/05 16:30:37 (GMT +100)\r\n  lib/ansible/modules/extras: (detached HEAD 5cc72c3f06) last updated 2016/10/05 16:30:37 (GMT +100)\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\nansible_role will silently ignore if there's no `tasks_from` file in the given role. I owuld expect error to be thrown (like when the whole role is misisng).\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\n- Create `roles/test/tasks` directory (role dir has to exist).\r\n- Run following playbook:\r\n\r\n```\r\n---\r\n- hosts: localhost\r\n  tasks:\r\n    - debug:\r\n        msg: Before one\r\n\r\n    - include_role:\r\n        name: test\r\n        tasks_from: missing\r\n\r\n    - debug:\r\n        msg: After onek\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nSomething similar to when the whole role is missing:\r\n```\r\nERROR! the role 'test' was not found in /Users/stepan/Projects/ansible-include-role/roles:/etc/ansible/roles:/Users/stepan/Projects/ansible-include-role\r\n\r\nThe error appears to have been in '/Users/stepan/Projects/ansible-include-role/test.yml': line 8, column 15, but may\r\nbe elsewhere in the file depending on the exact syntax problem.\r\n\r\nThe offending line appears to be:\r\n\r\n    - include_role:\r\n        name: test\r\n              ^ here\r\n```\r\n\r\n##### ACTUAL RESULTS\r\nAnsible happily ignores missing files and behaves like nothing happened:\r\n```\r\nPLAY [localhost] ***************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [localhost]\r\n\r\nTASK [debug] *******************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"Before one\"\r\n}\r\n\r\nTASK [debug] *******************************************************************\r\nok: [localhost] => {\r\n    \"msg\": \"After one\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=3    changed=0    unreachable=0    failed=0\r\n```\r\n\r\nI actually wanted to use this role to get rid of cross-role includes with paths like `../../xxx/tasks/client.yml` and ran into strange behaviour when multiple `include_role` statements in same playbook causes it to completely ignore `tasks_from` and run the `main.yml` instead, but as of now I'm not able to reliable reproduce that problem without using complex playbooks, which I can't share here unfortunately, but hopefully this would be first step to untangle that behaviour. Thanks."}}
{"actor":{"display_login":"stepanstipl"}}