You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When replacing whole router configuration file using iosxr_config module with replace: config - option, I cannot achieve idempotency. Instead I always get at least three lines:
Building configuration...
!! IOS XR Configuration 7.6.1
end
I'm not sure if this is caused by module or by IOS XR itself. I hcve tried to add those three lines in the configuration file but that didn't help.
---
- name: load a config from disk and replace the current confighosts:
- xr-routertasks:
- name: load a config from disk and replace the current configcisco.iosxr.iosxr_config:
src: "{{inventory_hostname}}-config.cfg"replace: configbackup: yes
EXPECTED RESULTS
Because of there is no changes in the source configuration file, idempotency should be achieved and we should get clear diff. Ansible should report OK instead of CHANGED.
ACTUAL RESULTS
Ansible thinks there are always changes to the device even there are not.
user@ubuntuserver:~/network/acme-network-network-automation$ ansible-playbook -i hosts ansible-push-config.yml --ask-vault-pass --diff -vvvv
ansible-playbook [core 2.12.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 2.10.1
libyaml = True
Using /etc/ansible/ansible.cfg as config file
Vault password:
setting up inventory plugins
host_list declined parsing /home/user/network/acme-network-network-automation/hosts as it did not pass its verify_file() method
script declined parsing /home/user/network/acme-network-network-automation/hosts as it did not pass its verify_file() method
auto declined parsing /home/user/network/acme-network-network-automation/hosts as it did not pass its verify_file() method
Not replacing invalid character(s) "{'-'}" in group name (xr-routers)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
Not replacing invalid character(s) "{'-'}" in group name (xr-routers)
Not replacing invalid character(s) "{'-'}" in group name (xr-routers)
Parsed /home/user/network/acme-network-network-automation/hosts inventory source with ini plugin
Loading collection cisco.iosxr from /home/user/.ansible/collections/ansible_collections/cisco/iosxr
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.8/dist-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: ansible-push-config.yml **********************************************************************************************************************************************************
Positional arguments: ansible-push-config.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
diff: True
inventory: ('/home/user/network/acme-network-network-automation/hosts',)
ask_vault_pass: True
forks: 5
1 plays in ansible-push-config.yml
PLAY [load a config from disk and replace the current config] ******************************************************************************************************************************
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f77963507f0> for vault_id=default
META: ran handlers
TASK [load a config from disk and replace the current config] ******************************************************************************************************************************
task path: /home/user/network/acme-network-network-automation/ansible-push-config.yml:12
Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
<10.10.10.10> attempting to start connection
<10.10.10.10> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /usr/local/bin/ansible-connection
<10.10.10.10> local domain socket does not exist, starting it
<10.10.10.10> control socket path is /home/user/.ansible/pc/dbea384fda
<10.10.10.10> Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
<10.10.10.10> Loading collection cisco.iosxr from /home/user/.ansible/collections/ansible_collections/cisco/iosxr
<10.10.10.10> local domain socket listeners started successfully
<10.10.10.10> loaded cliconf plugin ansible_collections.cisco.iosxr.plugins.cliconf.iosxr from path /home/user/.ansible/collections/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py for network_os cisco.iosxr.iosxr
<10.10.10.10> ssh type is set to auto
<10.10.10.10> autodetecting ssh_type
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
<10.10.10.10> ssh type is now set to paramiko
<10.10.10.10>
<10.10.10.10> local domain socket path is /home/user/.ansible/pc/dbea384fda
<10.10.10.10> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_config
<10.10.10.10> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<10.10.10.10> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_config at /home/user/.ansible/collections/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py
<10.10.10.10> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_config
<10.10.10.10> ANSIBLE_NETWORK_IMPORT_MODULES: complete
Building configuration...
!! IOS XR Configuration 7.6.1
end
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the
indentation
changed: [xr-router] => {
"backup_path": "/home/user/network/acme-network-network-automation/backup/xr-router_config.2022-08-04@13:11:45",
"changed": true,
"commands": [
"load harddisk:/ansible_config.txt"
],
"date": "2022-08-04",
"diff": {
"prepared": "Building configuration...\n!! IOS XR Configuration 7.6.1\nend"
},
"filename": "xr-router_config.2022-08-04@13:11:45",
"invocation": {
"module_args": {
"admin": false,
"after": null,
"backup": true,
"backup_options": null,
"before": null,
"comment": "configured by iosxr_config",
"config": null,
"disable_default_comment": false,
"exclusive": false,
"force": false,
"label": null,
"lines": null,
"match": "line",
"parents": null,
"provider": null,
"replace": "config",
"src": "" <--- configuration removed from output for security reasons
}
},
"shortname": "/home/user/network/acme-network-network-automation/backup/xr-router_config",
"time": "13:11:45"
}
META: ran handlers
META: ran handlers
PLAY RECAP *********************************************************************************************************************************************************************************
xr-router : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
The text was updated successfully, but these errors were encountered:
This might have something to do how device reports itself. Here I'm doing SSH directly to the router, entering configuration mode and seeing what changes I'm making without actually changing anything:
RP/0/RP0/CPU0:xr-router#conf
Fri Sep 30 08:30:30.652 EEST
RP/0/RP0/CPU0:xr-router(config)#show commit changes diff
Fri Sep 30 08:30:35.885 EEST
Building configuration...
!! IOS XR Configuration 7.7.1
end
RP/0/RP0/CPU0:xr-router(config)#
SUMMARY
When replacing whole router configuration file using iosxr_config module with replace: config - option, I cannot achieve idempotency. Instead I always get at least three lines:
I'm not sure if this is caused by module or by IOS XR itself. I hcve tried to add those three lines in the configuration file but that didn't help.
ISSUE TYPE
COMPONENT NAME
cisco.iosxr.iosxr_config
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
IOS XR Version 7.6.1
STEPS TO REPRODUCE
EXPECTED RESULTS
Because of there is no changes in the source configuration file, idempotency should be achieved and we should get clear diff. Ansible should report OK instead of CHANGED.
ACTUAL RESULTS
Ansible thinks there are always changes to the device even there are not.
The text was updated successfully, but these errors were encountered: