title: Ansible: Use of Diff command using Ansible
body: <p>I am trying to one simple task which is find out the difference between the two files and store it in notepad. I am not able to do it with command as well as shell. Please suggest where i am going wrong-</p>
  
  <pre><code>---
  - hosts: myserver
    tasks:
     - name: get the difference
       command: diff hosts.new hosts.mod
       register: diff
     - debug: var=diff.cmd
  </code></pre>
  
  <p>Error - </p>
  
  <pre><code>fatal: [zlp12037]: FAILED! =&gt; {"changed": true, "cmd": ["diff", "hosts.new", "hosts.mod"], "delta": "0:00:00.003102", "end": "2017-03-29 10:17:34.448063", "failed": true, "rc": 1, "start": "2017-03-29 10:17:34.444961", "stderr": "", "stdout":
  </code></pre>