【发布时间】:2020-07-14 17:50:47
【问题描述】:
我正在阅读这篇文章 (https://blog.networktocode.com/post/generating-diff-with-ansible/),其中提到我们可以同时使用检查和差异模式。我正在尝试将其用于 Cisco 和 Extreme 设备的黄金配置审计(根据设备上存在的内容审计预先决定的配置)。下面是我的剧本——
# task to audit & heal ntp configuration
- name: Set NTP template
ios_config:
src: "{{domain}}_{{ansible_network_os}}_ntp.cfg"
match: line
register: ntp_result
下面是我的模板-
ntp server 10.19.70.1
Ansible 突出显示它将更改配置。下面是我得到的结果。令人惊讶的是,我没有得到任何配置差异。
"ntp_result": {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"commands": [
"configure ntp server add x.x.x.x"
],
"failed": false,
"updates": [
"configure ntp server add x.x.x.x"
],
"warnings": [
"unable to perform diff against running-config due to check mode"
]
}
为什么我没有得到配置差异?知道有什么问题吗?
【问题讨论】: