{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/23912","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/23912/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/23912/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/23912/events","html_url":"https://github.com/ansible/ansible/issues/23912","id":223841118,"number":23912,"title":"Diff setting via configuration/environment variable has no effect","user":{"login":"nblock","id":131119,"avatar_url":"https://avatars1.githubusercontent.com/u/131119?v=3","gravatar_id":"","url":"https://api.github.com/users/nblock","html_url":"https://github.com/nblock","followers_url":"https://api.github.com/users/nblock/followers","following_url":"https://api.github.com/users/nblock/following{/other_user}","gists_url":"https://api.github.com/users/nblock/gists{/gist_id}","starred_url":"https://api.github.com/users/nblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nblock/subscriptions","organizations_url":"https://api.github.com/users/nblock/orgs","repos_url":"https://api.github.com/users/nblock/repos","events_url":"https://api.github.com/users/nblock/events{/privacy}","received_events_url":"https://api.github.com/users/nblock/received_events","type":"User","site_admin":false},"labels":[{"id":454885231,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.3","name":"affects_2.3","color":"5319e7","default":false},{"id":48276055,"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":503572087,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-24T14:35:44Z","updated_at":"2017-04-24T17:31:33Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\ncore\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.3.0.0\r\n  config file = /home/user/code/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.11 (default, Mar 20 2016, 15:46:50) [GCC 5.3.0]\r\n```\r\n\r\n##### CONFIGURATION\r\ndepending on the scenario, see below:\r\n* OK: when using ```--diff``` command line parameter\r\n* FAIL: when using ```ANSIBLE_DIFF_ALWAYS=true ansible-playbook [args]```\r\n* FAIL: with the following snippet in ansible.cfg:\r\n```\r\n  [diff]\r\n  always = True\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\nArch Linux\r\n\r\n##### SUMMARY\r\nThe diff setting has no effect when specified via configuration file or environment variable.\r\n\r\n##### STEPS TO REPRODUCE\r\n* Create the following playbook:\r\n```\r\n---\r\n- hosts: all\r\n  tasks:\r\n    - name: Set a random number in motd\r\n      template:\r\n        src: nodiff-motd.j2\r\n        dest: /etc/motd\r\n        owner: root\r\n        group: root\r\n        mode: 0644\r\n```\r\n* Create the nodiff-motd.j2 template:\r\n```\r\nThe current random number is: {{ 1000 | random }}\r\n```\r\n* A inventory with a single host.\r\n\r\n##### EXPECTED RESULTS\r\nA diff output with each run (it should not matter where the diff option is configured).\r\n\r\n##### ACTUAL RESULTS\r\n* Works if diff is enabled via command line parameter: ```$ ansible-playbook -i inventories/development.ini --diff nodiff.yml```\r\n```\r\n  TASK [Set a random number in motd] ****\r\n  --- before: /etc/motd\r\n  +++ after: dynamically generated\r\n  @@ -1 +1 @@\r\n  -The current random number is: 257\r\n  +The current random number is: 682\r\n```\r\n* Does not work with the following snippet in ansible.cfg:\r\n```\r\n  [diff]\r\n  always = true\r\n```\r\n```\r\n  $ ansible-playbook -i inventories/development.ini nodiff.yml\r\n  [snipped]\r\n  TASK [Set a random number in motd] ****\r\n  changed: [devel]\r\n```\r\n* Does not work when specified as environment variable: ```$ ANSIBLE_DIFF_ALWAYS=1 ansible-playbook -i inventories/development.ini nodiff.yml```\r\n```\r\n  TASK [Set a random number in motd] ****\r\n  changed: [devel]\r\n```\r\n\r\nThis feature was added with: https://github.com/ansible/ansible/commit/2291163a7a37876fde2b63746ca52aeba0bb7e2a"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/296760328","html_url":"https://github.com/ansible/ansible/issues/23912#issuecomment-296760328","issue_url":"https://api.github.com/repos/ansible/ansible/issues/23912","id":296760328,"user":{"login":"alikins","id":15162,"avatar_url":"https://avatars3.githubusercontent.com/u/15162?v=3","gravatar_id":"","url":"https://api.github.com/users/alikins","html_url":"https://github.com/alikins","followers_url":"https://api.github.com/users/alikins/followers","following_url":"https://api.github.com/users/alikins/following{/other_user}","gists_url":"https://api.github.com/users/alikins/gists{/gist_id}","starred_url":"https://api.github.com/users/alikins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikins/subscriptions","organizations_url":"https://api.github.com/users/alikins/orgs","repos_url":"https://api.github.com/users/alikins/repos","events_url":"https://api.github.com/users/alikins/events{/privacy}","received_events_url":"https://api.github.com/users/alikins/received_events","type":"User","site_admin":false},"created_at":"2017-04-24T17:31:33Z","updated_at":"2017-04-24T17:31:33Z","body":"Currently, ANSIBLE_DIFF_ALWAYS=true  and the config setting are a little different than the cli --diff options.\r\n\r\nANSIBLE_DIFF_ALWAYS=true and config option makes tasks/modules always provide diff information in their returned data. \r\n\r\nAdding '--diff' to the cli also does that, but also shows that data from the tasks (via the default callback,  but the diff callback is only triggered if the the strategy sees the cli '--diff' option via PlaybookExecutor->TaskQueueManager->Strategy).\r\n\r\nBut that is just current behavior, making them behave the same seems reasonable to me."}}
{"actor":{"display_login":"alikins"}}