{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/11034","labels_url":"https://api.github.com/repos/ansible/ansible/issues/11034/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/11034/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/11034/events","html_url":"https://github.com/ansible/ansible/pull/11034","id":78184911,"number":11034,"title":"Pass same host value for runner_on_file_diff as runner_on_ok","user":{"login":"ubergeek42","id":672279,"avatar_url":"https://avatars.githubusercontent.com/u/672279?v=3","gravatar_id":"","url":"https://api.github.com/users/ubergeek42","html_url":"https://github.com/ubergeek42","followers_url":"https://api.github.com/users/ubergeek42/followers","following_url":"https://api.github.com/users/ubergeek42/following{/other_user}","gists_url":"https://api.github.com/users/ubergeek42/gists{/gist_id}","starred_url":"https://api.github.com/users/ubergeek42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubergeek42/subscriptions","organizations_url":"https://api.github.com/users/ubergeek42/orgs","repos_url":"https://api.github.com/users/ubergeek42/repos","events_url":"https://api.github.com/users/ubergeek42/events{/privacy}","received_events_url":"https://api.github.com/users/ubergeek42/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bugfix_pull_request","name":"bugfix_pull_request","color":"ded270"},{"url":"https://api.github.com/repos/ansible/ansible/labels/easyfix","name":"easyfix","color":"eb6420"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P3","name":"P3","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-19T17:40:16Z","updated_at":"2015-07-25T15:38:48Z","closed_at":"2015-07-25T15:38:48Z","pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/11034","html_url":"https://github.com/ansible/ansible/pull/11034","diff_url":"https://github.com/ansible/ansible/pull/11034.diff","patch_url":"https://github.com/ansible/ansible/pull/11034.patch"},"body":"##### Issue Type:\r\n\r\nBugfix Pull Request\r\n\r\n##### Ansible Version:\r\n```\r\nansible 2.0.0 (devel da6d15d1f9) last updated 2015/05/19 11:31:05 (GMT -400)\r\n  lib/ansible/modules/core: (detached HEAD 7dd9f57e16) last updated 2015/05/19 12:50:34 (GMT -400)\r\n  lib/ansible/modules/extras: (detached HEAD 576d94e8d4) last updated 2015/05/19 12:50:39 (GMT -400)\r\n  v2/ansible/modules/core: (detached HEAD 85c8a892c8) last updated 2015/05/19 12:50:42 (GMT -400)\r\n  v2/ansible/modules/extras: (detached HEAD 70ea058563) last updated 2015/05/19 12:50:44 (GMT -400)\r\n  configured module search path = None\r\n```\r\n\r\n##### Ansible Configuration:\r\n\r\nN/A\r\n\r\n##### Environment:\r\n\r\nUbuntu 14.04\r\n\r\n##### Summary:\r\n\r\n`runner_on_file_diff` uses a different value for `host` than `runner_on_ok` or `runner_on_failed`.\r\n\r\n`runner_on_file_diff` uses `conn.host`, all others simply use `host`. What this means is that my callback plugin has to do more work to correlate the diff with the correct host. See the code diff for the very simple fix.\r\n\r\n##### Steps To Reproduce:\r\n\r\ninventory\r\n```\r\n[all]\r\nsome_name_here        ansible_ssh_host=localhost\r\n```\r\n\r\nplaybook.yml\r\n```yaml\r\n---\r\n- hosts: all\r\n  tasks:\r\n      - template: src=test.j2 dest=/tmp/bugreport.txt\r\n```\r\n\r\ntest.j2\r\n```jinja2\r\n# {{ansible_managed}}\r\n```\r\n\r\ncallback_plugins/bugreport.py\r\n```python\r\nclass CallbackModule(object):\r\n    def runner_on_file_diff(self, host, diff):\r\n        print(\"runner_on_file_diff\", host)\r\n    def runner_on_ok(self, host, res):\r\n        print(\"runner_on_ok\", host)\r\n```\r\n\r\nRun ansible:\r\n```\r\nansible-playbook -i inventory play.yml --diff\r\n```\r\n\r\n##### Expected Results:\r\n\r\nI expect the print value to show the same hostname for each callback. I also expect that value to be the one from the inventory file, not the one used for the `ansible_ssh_host` variable. E.g. for the given setup above I'd expect to see `some_name_here` for both.\r\n\r\n##### Actual Results:\r\n\r\nInstead what I end up seeing is `localhost` for the `runner_on_file_diff` callback, and `some_name_here` for the `runner_on_ok` callback. This pull request makes the very small change from `conn.host` to `host`, which then makes the callback act as expected.\r\n\r\n```\r\nTASK: [template src=test.j2 dest=/tmp/bugreport.txt] ************************** \r\n--- before\r\n+++ after\r\n@@ -0,0 +1 @@\r\n+# Ansible managed: /tmp/ansible-test/test.j2 modified on 2015-05-19 12:57:28 by ubergeek42 on test\r\n\r\n('runner_on_file_diff', 'localhost')\r\nchanged: [some_name_here]\r\n('runner_on_ok', 'some_name_here')\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/124853894","html_url":"https://github.com/ansible/ansible/pull/11034#issuecomment-124853894","issue_url":"https://api.github.com/repos/ansible/ansible/issues/11034","id":124853894,"user":{"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},"created_at":"2015-07-25T15:38:48Z","updated_at":"2015-07-25T15:38:48Z","body":"fixed via 1026e06e31dc10f3d9a42570ea4499a4ef95f72a, in current devel this will be built in when we re-add the diff feature"}}