02-17-2023 11:40 AM
Hi all,
Hopefully someone might be able to help out. I've been wrestling with this for a while. I'm fairly new to ansible and trying to run a playbook against a pair of nexus switches that will change the description of ports based on the information it gets from cisco.nxos.nxos_facts ( using cdp neighbor information). I've run this in a lab environment successfully but when running against our live environment, it fails.
This is the playbook i'm trying to run:
********************************************************************************************************************************
The full traceback is:
File "/home/administrator/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/nxos.py", line 127, in run_commands
out = connection.run_commands(commands, check_rc)
File "/usr/lib/python3/dist-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [SDS01]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"available_network_resources": false,
"gather_network_resources": [
"all"
],
"gather_subset": [
"all"
]
}
},
"msg": "command timeout triggered, timeout value is 30 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.",
"warnings": [
"** 'feature telemetry' is not enabled. Module will auto-enable feature telemetry ** "
]
}
<172.17.252.72> ANSIBLE_NETWORK_IMPORT_MODULES: complete
The full traceback is:
File "/home/administrator/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/nxos.py", line 127, in run_commands
out = connection.run_commands(commands, check_rc)
File "/usr/lib/python3/dist-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [SDS02]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"available_network_resources": false,
"gather_network_resources": [
"all"
],
"gather_subset": [
"all"
]
}
},
"msg": "command timeout triggered, timeout value is 30 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.",
"warnings": [
"** 'feature telemetry' is not enabled. Module will auto-enable feature telemetry ** "
]
}
********************************************************************************************************************************
Sorry for the long information but hope this helps. If you need some more information to assist, I'll be happy to provide it. I've looked at documentation but like I said, I'm very new to ansible and still learning. Thanks in advanced for your help.
Roberto
Solved! Go to Solution.
02-18-2023 12:28 AM - edited 02-18-2023 12:30 AM
Hi
Increase the command timeout, see https://docs.ansible.com/ansible/latest/network/getting_started/network_connection_options.html
I prefer using a local ansible.cfg in the root of every project folder:
[persistent_connection] command_timeout = 240
But all the options described in the link above will work.
HTH
02-20-2023 11:38 AM
Hi the ansible_network_os is 'cisco.nxos.nxos' not 'nxos'.
hth
Marcel
02-18-2023 12:28 AM - edited 02-18-2023 12:30 AM
Hi
Increase the command timeout, see https://docs.ansible.com/ansible/latest/network/getting_started/network_connection_options.html
I prefer using a local ansible.cfg in the root of every project folder:
[persistent_connection] command_timeout = 240
But all the options described in the link above will work.
HTH
02-20-2023 11:30 AM
Hi @Marcel Zehnder ,
Thank you for your response! I had actually tried this method of changing the time, and before i went up to 120. I changed as you suggested to 'command_timeout = 240' and it worked!! So thank you for that, one step closer. I guess it needed more time to gather facts since they are connected to A LOT of devices.
Now the next step, is changing the ports description. I uncommented those sections and the script gathered all the information but ended up 'skipping' the part for changing the ports.
Here's a small snippet of a few interfaced that failed to change and the reason why:
skipping: [SDS-01] => (item={'key': 'Ethernet8/40', 'value': [{'port': 'TenGigabitEthernet1/1/4', 'host': 'SBS-I-20.company.com', 'sysname': 'SBS-I-20.company.com'}]}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"key": "Ethernet8/40",
"value": [
{
"host": "SBS-I-20.company.com",
"port": "TenGigabitEthernet1/1/4",
"sysname": "SBS-I-20.company.com"
}
]
},
"skip_reason": "Conditional result was False"
}
skipping: [SDS-01] => (item={'key': 'Ethernet8/41', 'value': [{'port': 'TenGigabitEthernet1/1/3', 'host': 'SBS-K-10.company.com', 'sysname': 'SBS-K-10.company.com'}]}) => {
"ansible_loop_var": "item",
"changed": false,
"item": {
"key": "Ethernet8/41",
"value": [
{
"host": "SBS-K-10.company.com",
"port": "TenGigabitEthernet1/1/3",
"sysname": "SBS-K-10.company.com"
}
]
},
"skip_reason": "Conditional result was False"
}
***************************************
So basically, something in this task (shown below) is throwing off a condition and skipping the rest, but the only condition I can think of is "when: ansible_network_os == 'nxos'" .
02-20-2023 11:38 AM
Hi the ansible_network_os is 'cisco.nxos.nxos' not 'nxos'.
hth
Marcel
02-20-2023 01:48 PM
That was it!! Wow, just one little piece of syntax. Awesome, got my script to run successfully, and ports labeled accordingly based on their cdp info. I was working on it for quite a while, thanks a lot for your help, much appreciated!!
02-20-2023 01:55 PM
i'm glad if i could help.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide