Stack Overflow Asked by sunder on December 13, 2021
I was going thru this post (https://blog.networktocode.com/post/generating-diff-with-ansible/) where its mentioned that we can use check and diff mode together. I am trying to use that for gold config audit (audit pre decided config against what is present on device) for Cisco and Extreme devices. Below is my playbook –
# task to audit & heal ntp configuration
- name: Set NTP template
ios_config:
src: "{{domain}}_{{ansible_network_os}}_ntp.cfg"
match: line
register: ntp_result
Below is my template –
ntp server 10.19.70.1
Ansible highlighting that it is going to change the config. Below is what result I am getting. Surprisingly I am not getting any config diff.
"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"
]
}
Why I am not getting config diff? Any idea what is wrong?
This is a limitation of the module: you can only combine check
with diff
using the diff_against
options of startup
and intended
, but not running
.
corresponding Ansible source here:
if module.params['diff_against'] == 'running':
if module.check_mode:
module.warn("unable to perform diff against running-config due to check mode")
Answered by Uku Loskit on December 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP