{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13232","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13232/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13232/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13232/events","html_url":"https://github.com/ansible/ansible/issues/13232","id":118059468,"number":13232,"title":"Option --diff does not show changes when template module used with with_items loop.","user":{"login":"ahes","id":1119356,"avatar_url":"https://avatars.githubusercontent.com/u/1119356?v=3","gravatar_id":"","url":"https://api.github.com/users/ahes","html_url":"https://github.com/ahes","followers_url":"https://api.github.com/users/ahes/followers","following_url":"https://api.github.com/users/ahes/following{/other_user}","gists_url":"https://api.github.com/users/ahes/gists{/gist_id}","starred_url":"https://api.github.com/users/ahes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahes/subscriptions","organizations_url":"https://api.github.com/users/ahes/orgs","repos_url":"https://api.github.com/users/ahes/repos","events_url":"https://api.github.com/users/ahes/events{/privacy}","received_events_url":"https://api.github.com/users/ahes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/5","html_url":"https://github.com/ansible/ansible/milestones/v2","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/5/labels","id":975800,"number":5,"title":"v2","description":null,"creator":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":595,"state":"open","created_at":"2015-02-11T19:43:06Z","updated_at":"2015-12-10T17:53:54Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-11-20T15:08:20Z","updated_at":"2015-12-10T17:53:54Z","closed_at":"2015-12-10T17:53:54Z","body":"**Issue Type:**\r\nBug Report\r\n\r\n**Ansible Version:**\r\n    ansible 2.0.0 (devel d75e707af5) last updated 2015/11/20 15:57:21 (GMT +200)\r\n      lib/ansible/modules/core: (detached HEAD 88e0bfd75d) last updated 2015/11/20 15:57:24 (GMT +200)\r\n      lib/ansible/modules/extras: (detached HEAD 7da1f8d4ca) last updated 2015/11/20 15:57:27 (GMT +200)\r\n      config file =\r\n      configured module search path = Default w/o overrides\r\n\r\n**Ansible Configuration:**\r\nNone/Default\r\n\r\n**Environment:**\r\nDebian GNU/Linux 8.2 Jessie \r\n\r\n**Summary:**\r\nOption `--diff` does not show changes when template module used with loops.\r\nTested w/ and w/o `--check` option and with `with_items` and `with_first_found` loops.\r\n\r\n**Steps To Reproduce:**\r\ntest.yml playbook:\r\n```\r\n- hosts: localhost\r\n  tasks:\r\n  - template: src={{ item }}.j2 dest=/tmp/test\r\n    with_items:\r\n      - test\r\n```\r\n\r\ntest.j2 template:\r\n```\r\nHello\r\n```\r\n\r\n**Expected Results:**\r\n```\r\n$ ansible-playbook test.yml --check --diff\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [localhost]\r\n\r\nTASK [template dest=/tmp/test src={{ item }}.j2] *******************************\r\nchanged: [localhost] => (item=test)\r\n--- before\r\n+++ after: dynamically generated\r\n@@ -0,0 +1 @@\r\n+Hello\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=2    changed=1    unreachable=0    failed=0\r\n```\r\n\r\n**Actual Results:**\r\n```\r\n$ ansible-playbook test.yml --check --diff\r\nPLAY ***************************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [localhost]\r\n\r\nTASK [template dest=/tmp/test src={{ item }}.j2] *******************************\r\nchanged: [localhost] => (item=test)\r\n\r\nPLAY RECAP *********************************************************************\r\nlocalhost                  : ok=2    changed=1    unreachable=0    failed=0\r\n```"}}