{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13262","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13262/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13262/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13262/events","html_url":"https://github.com/ansible/ansible/issues/13262","id":118433547,"number":13262,"title":"feature request: looping over blocks","user":{"login":"smiller171","id":3587913,"avatar_url":"https://avatars.githubusercontent.com/u/3587913?v=3","gravatar_id":"","url":"https://api.github.com/users/smiller171","html_url":"https://github.com/smiller171","followers_url":"https://api.github.com/users/smiller171/followers","following_url":"https://api.github.com/users/smiller171/following{/other_user}","gists_url":"https://api.github.com/users/smiller171/gists{/gist_id}","starred_url":"https://api.github.com/users/smiller171/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smiller171/subscriptions","organizations_url":"https://api.github.com/users/smiller171/orgs","repos_url":"https://api.github.com/users/smiller171/repos","events_url":"https://api.github.com/users/smiller171/events{/privacy}","received_events_url":"https://api.github.com/users/smiller171/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/feature_idea","name":"feature_idea","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":33,"created_at":"2015-11-23T17:43:27Z","updated_at":"2016-03-25T20:01:18Z","closed_at":null,"body":"##### Issue Type:\r\n\r\nFeature Idea\r\n\r\n##### Ansible Version:\r\n\r\nAnsible 2.0.0_rc-1\r\n\r\n##### Ansible Configuration:\r\n\r\nNA\r\n\r\n##### Environment:\r\n\r\nUbuntu 15.10\r\n\r\n##### Summary:\r\n\r\nThere are a number of use-cases where it would be valuable to be able to loop over a block of tasks, such that a few tasks are done in order, and that specific block of tasks are looped over for some set of values. It seems that the new block functionality could lend itself well to this if you were to enable looping over blocks.\r\n\r\n##### Steps To Reproduce:\r\n\r\n```yaml\r\n- hosts: localhost\r\n  connection: local\r\n  tasks:\r\n  - block:\r\n    - debug: msg=\"task 1 loop {{item}}\"\r\n    - debug: msg=\"task 2 loop {{item}}\"\r\n    with_items:\r\n    - \"1\"\r\n    - \"2\"\r\n```\r\n\r\n##### Expected Results:\r\n\r\n```\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [localhost]\r\n\r\nTASK [debug msg=task 1 loop {{item}}] ******************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"msg\": \"task 1 loop 1\"\r\n}\r\n\r\nTASK [debug msg=task 2 loop {{item}}] ******************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"msg\": \"task 2 loop 1\"\r\n}\r\n\r\nTASK [debug msg=task 1 loop {{item}}] ******************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"msg\": \"task 1 loop 2\"\r\n}\r\n\r\nTASK [debug msg=task 2 loop {{item}}] ******************************************\r\nok: [localhost] => {\r\n    \"changed\": false, \r\n    \"msg\": \"task 2 loop 2\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=5    changed=0    unreachable=0    failed=0\r\n```\r\n\r\n##### Actual Results:\r\n\r\n```\r\nERROR! 'with_items' is not a valid attribute for a Block\r\n\r\nThe error appears to have been in '/root/test.yml': line 5, column 5, 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  tasks:\r\n  - block:\r\n    ^ here\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/201463542","html_url":"https://github.com/ansible/ansible/issues/13262#issuecomment-201463542","issue_url":"https://api.github.com/repos/ansible/ansible/issues/13262","id":201463542,"user":{"login":"DerekL","id":1245096,"avatar_url":"https://avatars.githubusercontent.com/u/1245096?v=3","gravatar_id":"","url":"https://api.github.com/users/DerekL","html_url":"https://github.com/DerekL","followers_url":"https://api.github.com/users/DerekL/followers","following_url":"https://api.github.com/users/DerekL/following{/other_user}","gists_url":"https://api.github.com/users/DerekL/gists{/gist_id}","starred_url":"https://api.github.com/users/DerekL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DerekL/subscriptions","organizations_url":"https://api.github.com/users/DerekL/orgs","repos_url":"https://api.github.com/users/DerekL/repos","events_url":"https://api.github.com/users/DerekL/events{/privacy}","received_events_url":"https://api.github.com/users/DerekL/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T20:01:18Z","updated_at":"2016-03-25T20:01:18Z","body":"Using 2.1.0 devel and getting:\r\n\r\n```\r\n'with_items' is not a valid attribute for a Block\r\n\r\nThe offending line appears to be:\r\n\r\n    -\r\n      block:\r\n      ^ here\r\n```\r\n"}}