{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12832","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12832/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12832/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12832/events","html_url":"https://github.com/ansible/ansible/issues/12832","id":112271534,"number":12832,"title":"Lookup function fails playbook even when skipped","user":{"login":"xiaclo","id":1924401,"avatar_url":"https://avatars.githubusercontent.com/u/1924401?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaclo","html_url":"https://github.com/xiaclo","followers_url":"https://api.github.com/users/xiaclo/followers","following_url":"https://api.github.com/users/xiaclo/following{/other_user}","gists_url":"https://api.github.com/users/xiaclo/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaclo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaclo/subscriptions","organizations_url":"https://api.github.com/users/xiaclo/orgs","repos_url":"https://api.github.com/users/xiaclo/repos","events_url":"https://api.github.com/users/xiaclo/events{/privacy}","received_events_url":"https://api.github.com/users/xiaclo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-20T02:16:12Z","updated_at":"2015-10-22T16:40:41Z","closed_at":null,"body":"I know the name is a bit confusing, so here's a playbook:\r\n\r\n```\r\n- hosts: localhost\r\n  gather_facts: false\r\n  tasks:\r\n    - debug: var=\"{{ item }}\"\r\n      with_indexed_items: \"{{ not_defined }}\"\r\n      when: not_defined is defined\r\n```\r\n\r\nResults in:\r\n\r\n```\r\n$ ansible-playbook test.yml\r\n\r\nPLAY [localhost] **************************************************************\r\n\r\nTASK: [debug var=\"{{ item }}\"] ************************************************\r\nfatal: [localhost] => with_indexed_items expects a list\r\n\r\nFATAL: all hosts have already failed -- aborting\r\n\r\nPLAY RECAP ********************************************************************\r\n           to retry, use: --limit @/home/user/test.retry\r\n\r\nlocalhost                  : ok=0    changed=0    unreachable=1    failed=0\r\n```\r\n\r\nExpected behaviour: The debug statement should be skipped instead of failing.\r\n\r\nThis also happens even if an entire role is skipped, making it also impossible to use with_indexed_items in skipped roles (assuming earlier statements populate the items)."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/150283545","html_url":"https://github.com/ansible/ansible/issues/12832#issuecomment-150283545","issue_url":"https://api.github.com/repos/ansible/ansible/issues/12832","id":150283545,"user":{"login":"stajkowski","id":7319495,"avatar_url":"https://avatars.githubusercontent.com/u/7319495?v=3","gravatar_id":"","url":"https://api.github.com/users/stajkowski","html_url":"https://github.com/stajkowski","followers_url":"https://api.github.com/users/stajkowski/followers","following_url":"https://api.github.com/users/stajkowski/following{/other_user}","gists_url":"https://api.github.com/users/stajkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/stajkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stajkowski/subscriptions","organizations_url":"https://api.github.com/users/stajkowski/orgs","repos_url":"https://api.github.com/users/stajkowski/repos","events_url":"https://api.github.com/users/stajkowski/events{/privacy}","received_events_url":"https://api.github.com/users/stajkowski/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T16:40:41Z","updated_at":"2015-10-22T16:40:41Z","body":"What version are you on?  ansible --version"}}