difference in two file using ansible module

后端 未结 3 530
失恋的感觉
失恋的感觉 2021-01-06 05:16

I want to see if there is any changes in the file one present in local and other on the remote host. If there is any difference, it should be visible in screen what should

3条回答
  •  执笔经年
    2021-01-06 05:43

    This sounds like a task you can do with the debug module. Use diff to get the diff of both files. Register the output and use debug for display:

    - name: Generate diff
      command: diff  /tmp/abc.txt  /tmp/def.txt
      register: diff_result
    
    - name: Show diff result
      debug:
        var: diff_result
    

提交回复
热议问题