{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/35411","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/35411/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/35411/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/35411/events","html_url":"https://github.com/ansible/ansible/pull/35411","id":292037643,"number":35411,"title":"Add support for defining index var for task loops","user":{"login":"agaffney","id":825875,"avatar_url":"https://avatars2.githubusercontent.com/u/825875?v=4","gravatar_id":"","url":"https://api.github.com/users/agaffney","html_url":"https://github.com/agaffney","followers_url":"https://api.github.com/users/agaffney/followers","following_url":"https://api.github.com/users/agaffney/following{/other_user}","gists_url":"https://api.github.com/users/agaffney/gists{/gist_id}","starred_url":"https://api.github.com/users/agaffney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agaffney/subscriptions","organizations_url":"https://api.github.com/users/agaffney/orgs","repos_url":"https://api.github.com/users/agaffney/repos","events_url":"https://api.github.com/users/agaffney/events{/privacy}","received_events_url":"https://api.github.com/users/agaffney/received_events","type":"User","site_admin":false},"labels":[{"id":48464763,"url":"https://api.github.com/repos/ansible/ansible/labels/docs_pull_request","name":"docs_pull_request","color":"0052cc","default":false},{"id":48457821,"url":"https://api.github.com/repos/ansible/ansible/labels/feature_pull_request","name":"feature_pull_request","color":"006b75","default":false},{"id":61436281,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_revision","name":"needs_revision","color":"eb6450","default":false},{"id":636327968,"url":"https://api.github.com/repos/ansible/ansible/labels/support:community","name":"support:community","color":"ededed","default":false},{"id":636352796,"url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false},{"id":468273802,"url":"https://api.github.com/repos/ansible/ansible/labels/test","name":"test","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-01-26T21:31:28Z","updated_at":"2018-02-01T16:10:54Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/35411","html_url":"https://github.com/ansible/ansible/pull/35411","diff_url":"https://github.com/ansible/ansible/pull/35411.diff","patch_url":"https://github.com/ansible/ansible/pull/35411.patch"},"body":"##### SUMMARY\r\nThis adds support for an `index_var` field under `loop_control`, which controls the name of the variable used to store the current index in a task loop.\r\n\r\n##### ISSUE TYPE\r\n - Feature Pull Request\r\n\r\n##### COMPONENT NAME\r\ntask loop_control\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.5.0 (loop_index e6766cae6e) last updated 2018/01/26 14:29:04 (GMT -600)\r\n```\r\n\r\n##### ADDITIONAL INFORMATION\r\n\r\nPlaybook:\r\n\r\n```\r\n- hosts: localhost\r\n  gather_facts: no\r\n  tasks:\r\n    - debug:\r\n        msg: \"my_idx={{ my_idx }}, item={{ item }}\"\r\n      with_items:\r\n        - a\r\n        - b\r\n        - c\r\n      loop_control:\r\n        index_var: my_idx\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nTASK [debug] ******************************************************************************************************************************************************************************************************************************************************************\r\nok: [localhost] => (item=a) => {\r\n    \"changed\": false, \r\n    \"failed\": false, \r\n    \"item\": \"a\", \r\n    \"msg\": \"my_idx=0, item=a\"\r\n}\r\nok: [localhost] => (item=b) => {\r\n    \"changed\": false, \r\n    \"failed\": false, \r\n    \"item\": \"b\", \r\n    \"msg\": \"my_idx=1, item=b\"\r\n}\r\nok: [localhost] => (item=c) => {\r\n    \"changed\": false, \r\n    \"failed\": false, \r\n    \"item\": \"c\", \r\n    \"msg\": \"my_idx=2, item=c\"\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/362315132","html_url":"https://github.com/ansible/ansible/pull/35411#issuecomment-362315132","issue_url":"https://api.github.com/repos/ansible/ansible/issues/35411","id":362315132,"user":{"login":"gundalow","id":940557,"avatar_url":"https://avatars1.githubusercontent.com/u/940557?v=4","gravatar_id":"","url":"https://api.github.com/users/gundalow","html_url":"https://github.com/gundalow","followers_url":"https://api.github.com/users/gundalow/followers","following_url":"https://api.github.com/users/gundalow/following{/other_user}","gists_url":"https://api.github.com/users/gundalow/gists{/gist_id}","starred_url":"https://api.github.com/users/gundalow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gundalow/subscriptions","organizations_url":"https://api.github.com/users/gundalow/orgs","repos_url":"https://api.github.com/users/gundalow/repos","events_url":"https://api.github.com/users/gundalow/events{/privacy}","received_events_url":"https://api.github.com/users/gundalow/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T16:10:54Z","updated_at":"2018-02-01T16:10:54Z","author_association":"CONTRIBUTOR","body":"2017-02-01 decided not 2.5."}}
{"actor":{"display_login":"gundalow"}}