bug in nxos_config module

Hi Team

nxos_config module where Ansible cannot able to return below highlighted information from device rather it returns the config as changed.

Is this a bug? please help

Manual:

lab.device.local(config)# logging server x.x.x.x 6
Can’t configure more than 8 IP Servers

Through Ansible:

changed: [lab.device.local] => {
“changed”: true,
“commands”: [
“logging server x.x.x.x 6”,
“logging server x.x.x.x 6”
],
“invocation”: {
“module_args”: {
“after”: null,
“auth_pass”: null,
“authorize”: null,
“backup”: false,
“before”: null,
“defaults”: false,
“diff_against”: null,
“diff_ignore_lines”: null,
“force”: false,
“host”: null,
“intended_config”: null,
“lines”: [
“logging server x.x.x.x 6”,
“logging server x.x.x.x 6”
],
“match”: “line”,
“parents”: null,
“password”: null,
“port”: null,
“provider”: null,
“replace”: “line”,
“replace_src”: null,
“running_config”: null,
“save”: false,
“save_when”: “never”,
“src”: null,
“ssh_keyfile”: null,
“timeout”: null,
“transport”: null,
“use_ssl”: null,
“username”: null,
“validate_certs”: null
}
},
“updates”: [
“logging server x.x.x.x 6”,
“logging server x.x.x.x 6”
]
}

Any help would be appreciated !

Can anyone help on this?

Hi Pushparaj,

You can try to use changed_when. Haven't used nxos_config unfortunately yet.

Best,
Karol

See https://docs.ansible.com/ansible/devel/user_guide/playbooks_error_handling.html#defining-changed for more details on changed_when.

Hi Pushparaj,

This seems to happen because the stderr regex in the NX-OS terminal plugin doesn’t catch “Can’t configure more than 8 IP Servers”. However, with Ansible 2.9, the stdout and stderr regexes were made configurable options. Please refer to https://docs.ansible.com/ansible/latest/network/user_guide/network_debug_troubleshooting.html#task-failure-due-to-mismatched-error-regex-within-command-response-using-network-cli-connection-type for more information.

In this particular case, you can try adding the following to the task:
vars:
ansible_terminal_stderr_re:

  • pattern: “can’t configure (.*)”
    flags: 're.I

Thanks!

Thanks Nilashish …