title: Compare two files with Ansible
body: <p>I am struggling to find out how to compare two files. Tried several methods including this one which errors out with: </p>
  
  <blockquote>
    <p><strong><em>FAILED! => {"msg": "The module diff was not found in configured module paths. Additionally, core modules are missing. If this is a
    checkout, run 'git pull --rebase' to correct this problem."}</em></strong></p>
  </blockquote>
  
  <p>Is this the best practice to compare two files and ensure the contents are the same or is there a better way?</p>
  
  <p>Thanks in advance.</p>
  
  <p>My playbook:</p>
  
  <pre><code>- name: Find out if cluster management protocol is in use
        ios_command:
          commands:
            - show running-config | include ^line vty|transport input
        register: showcmpstatus
   - local_action: copy content="{{ showcmpstatus.stdout_lines[0] }}" dest=/poc/files/{{ inventory_hostname }}.result
      - local_action: diff /poc/files/{{ inventory_hostname }}.result /poc/files/transport.results
        failed_when: "diff.rc &gt; 1"
        register: diff
   - name: debug output
        debug: msg="{{ diff.stdout }}"
  </code></pre>