小编MrR*_*bot的帖子

使用Ansible比较两个文件

我正在努力找出如何比较两个文件。尝试了几种方法,包括此方法,该方法的错误之处在于:

失败!=> {“ msg”:“在已配置的模块路径中找不到模块差异。此外,核心模块丢失。如果这是签出,请运行'git pull --rebase'来纠正此问题。”}

这是比较两个文件并确保内容相同的最佳实践,还是有更好的方法?

提前致谢。

我的剧本:

- 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 > 1"
      register: diff
 - name: debug output
      debug: msg="{{ diff.stdout }}"
Run Code Online (Sandbox Code Playgroud)

ansible

2
推荐指数
1
解决办法
8346
查看次数

标签 统计

ansible ×1