-
Notifications
You must be signed in to change notification settings - Fork 22
Timeout while running arubaoss_command #99
Description
Hi!
I've been using ansible for automation with aruba switches for about 2 years and recently started encountering an inconsistent bug.
Below is the ansible playbook - it checks what switch model it is, and runs a specific command based on the switch model.
(i have also tested with specifically running show mac-a 1-24 by itself (no other commands) on a switch and got the same result, inconsistent timeouts).
---
- hosts: all
gather_facts: no
serial: 1
collections:
- arubanetworks.aos_switch
vars:
ansible_connection: network_cli
ansible_network_os: arubanetworks.aos_switch.arubaoss
ansible_command_timeout: 120
ansible_connect_timeout: 30
tasks:
- name: Check switch type
arubaoss_command:
commands:
- 'show modules'
register: model
- name: Show model var contents
debug:
msg: "{{ model.stdout }}"
- name: Show mac-address on all 8 ports (excluding uplinks)
arubaoss_command:
commands:
- 'no page'
- 'show system info | inc "MAC"'
- 'show mac-a 1-8'
register: outputa
when: model.stdout is search('JL258A')
- name: Display 8-port switch results
debug:
msg: "{{ outputa.stdout }}"
when:
- model.stdout is search('JL258A')
- outputa is defined
- name: Show mac-address on all 24 ports (excluding uplinks)
arubaoss_command:
commands:
- 'no page'
- 'show system info | inc "MAC"'
- 'show mac-a 1-24'
register: outputb
when: model.stdout is search('JL255A')
- name: Display 24-port switch results
debug:
msg: "{{ outputb.stdout }}"
when:
- model.stdout is search('JL255A')
- outputb is defined
- name: Show mac-address on all 48 ports (excluding uplinks)
arubaoss_command:
commands:
- 'no page'
- 'show system info | inc "MAC"'
- 'show mac-a 1-48'
register: outputc
when: model.stdout is search('JL558A')
- name: Display 48-port switch results
debug:
msg: "{{ outputc.stdout }}"
when:
- model.stdout is search('JL558A')
- outputc is definedbelow is the error i get:
fatal: [REDACTED]: FAILED! => {"changed": false, "msg": "command timeout triggered, timeout value is 30 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide."}
Below is the verbose debug log of the error:
TASK [Show model var contents] *************************************************
task path: /home/jenkins/agent/workspace/Ansible/Aruba/Q2-Aruba-get-mac-table/tools/Ansible/playbooks/aruba-mactable.yaml:20
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
ok: [REDACTED] => {
"msg": [
"Status and Counters - Module Information\n\n Chassis: 2930F-24G-PoE+-4SFP+ JL255A Serial Number: CN35HKW2NT"
]
}
TASK [Show mac-address on all 8 ports (excluding uplinks)] *********************
task path: /home/jenkins/agent/workspace/Ansible/Aruba/Q2-Aruba-get-mac-table/tools/Ansible/playbooks/aruba-mactable.yaml:24
skipping: [REDACTED] => {
"changed": false,
"false_condition": "model.stdout is search('JL258A')",
"skip_reason": "Conditional result was False"
}
TASK [Display 8-port switch results] *******************************************
task path: /home/jenkins/agent/workspace/Ansible/Aruba/Q2-Aruba-get-mac-table/tools/Ansible/playbooks/aruba-mactable.yaml:33
skipping: [REDACTED] => {
"false_condition": "model.stdout is search('JL258A')"
}
TASK [Show mac-address on all 24 ports (excluding uplinks)] ********************
task path: /home/jenkins/agent/workspace/Ansible/Aruba/Q2-Aruba-get-mac-table/tools/Ansible/playbooks/aruba-mactable.yaml:40
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
<REDACTED> ESTABLISH LOCAL CONNECTION FOR USER: jenkins
<REDACTED> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4 `"&& mkdir "` echo /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368 `" && echo ansible-tmp-1764131547.0075886-179-180057442574368="` echo /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368 `" ) && sleep 0'
Using module file /home/jenkins/.ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/modules/arubaoss_command.py
<REDACTED> PUT /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/tmpvuxaohff TO /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368/AnsiballZ_arubaoss_command.py
<REDACTED> EXEC /bin/sh -c 'chmod u+rwx /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368/ /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368/AnsiballZ_arubaoss_command.py && sleep 0'
<REDACTED> EXEC /bin/sh -c '/usr/bin/python3 /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368/AnsiballZ_arubaoss_command.py && sleep 0'
<REDACTED> EXEC /bin/sh -c 'rm -f -r /home/jenkins/.ansible/tmp/ansible-local-153tk3g2vm4/ansible-tmp-1764131547.0075886-179-180057442574368/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
File "/tmp/ansible_arubaoss_command_payload_rj2osjaa/ansible_arubaoss_command_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py", line 441, in run_cli_commands
return conn.run_commands(commands=commands, check_rc=check_rc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ansible_arubaoss_command_payload_rj2osjaa/ansible_arubaoss_command_payload.zip/ansible/module_utils/connection.py", line 183, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [REDACTED]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_version": "None",
"commands": [
"no page",
"show system info | inc \"MAC\"",
"show mac-a 1-24"
],
"host": null,
"interval": 1,
"match": "all",
"output_file": null,
"password": null,
"port": null,
"provider": null,
"retries": 10,
"ssh_keyfile": null,
"timeout": null,
"use_ssl": null,
"username": null,
"validate_certs": false,
"wait_for": null
}
},
"msg": "command timeout triggered, timeout value is 120 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide."
}
PLAY RECAP *********************************************************************
REDACTED : ok=2 changed=0 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0 We have tried extending the command timeout to 300 seconds, even out to 600 seconds, and the same result.
I can log into the switch and see the ansible agent log in successfully.
it also can run commands fine because it successfully checks what switch model it is and the logic works.