aruba / aruba-ansible-modules

Aruba Ansible Modules
Apache License 2.0
80 stars 36 forks source link

No output from **arubaoss_command:** when more tasks running in parallel #118

Closed zejdlikt closed 3 years ago

zejdlikt commented 4 years ago

Hello, i am running simple playbook using arubaoss_command for 4 hosts (switches).

playbook:

- hosts: all
  vars:
    ansible_connection: network_cli
  serial: 4
  gather_facts: False
  tasks:
    - name: Execute show run on the switchs
      arubaoss_command:
        commands: ['show runn']
        output_file: "{{ inventory_hostname }}"

and

inventory:

all:
  vars:
    ansible_user: user
    ansible_password: password
    ansible_network_os: arubaoss
    ansible_connection: network_cli  # REST API connection method

  hosts:
    aru1:
      ansible_host: 172.28.20.15
    aru2:
      ansible_host: 172.28.20.16
    aru3:
      ansible_host: 172.28.20.17
    aru4:
      ansible_host: 172.28.20.18

when i run this playbook for one switch only, i got expected results. The same (correct) results i get when i configure serial: 1 - so running tasks sequentially (serial_1_output.txt). When i run it for all switches, then no results are shown - no stdout output available (serial_5_output.txt)

Any idea what could be the issue?

Thank you

serial_1_output.txt serial_5_output.txt

derekwangHPEAruba commented 4 years ago

Hey zejdlikt,

I took a look at this issue today--I tried to reproduce your problem but couldn't.

I was able to run it with serial: 5 successfully:

serial_5_output.txt

What I did:

  1. I ran it with four devices in my test environment:

I noticed that in your environment you have three devices running KB.16.07.0003 and one device running KB.16.10.0009. Only firmware version 16.08 and later is supported officially, so I would recommend updating all your devices to a later firmware, and trying again.

  1. My environment is using Python2 as the interpreter for Ansible. I tried to get my environment to run Ansible using with Python3 but didn't have much luck. If your issue persists, that's what I would look at next.

So, to summarize here's what I suggest:

  1. Upgrade all devices to 16.08 or up If that doesn't work,
  2. Try running Ansible with Python 2

Let me know if the issue persists!

Cheers, Derek

zejdlikt commented 4 years ago

Hello Derek,

thanks a lot for your effort.

1) so far i wasn't able to upgrade FW on mentioned 3 switches (currently running a longer running network test there) 2) what i tested already with no difference (no outputs):

What i have observed is, the output it not always completely empty - sometime by some (random) switches, the correct output is there - like 1st run - no output, 2nd run - no output, 3rd run - output from ARU-001, 4th run - no output, 5th run - output from ARU-004 etc....

It is worthwhile to mention that all those test were running over VPN - RTT around 100ms. So i have started suspecting whether it could be something related to networks /module-setup-ansible-paramiko/ related issues. I have moved this playbook to the local network (RTT around 0.3ms) and from local network i am able to get correct results every time i run the playbook. So it seems to be related to some timeout/latency, but so far no idea what could be tuned.

By any chance, could you check similar setup - running this playbook via some higher latency link - VPN?

BR, t.

zejdlikt commented 4 years ago

Example output - running playbook several times over higher RTT link (last run, some output came from aru2):

serial_5_output_repeted_over_higher_RTT_link.txt

Catchestherust commented 3 years ago

I met the same problem using arubaoss_command : I used this module few times without issue. Then I wanted to use it with a network connection with more latency (ssh with remote forwarding port to a remote Ansible over the Internet) I face an issue : If I run a playbook on a unique host to do a "show run", sometime I get the expected output, sometime I get an empty output.

Catchestherust commented 3 years ago

I found a workaround which is to add a wait_for instruction : tasks:

zejdlikt commented 3 years ago

I found a workaround which is to add a wait_for instruction : tasks:

  • name: execute show run arubaoss_command: commands: 'show run' wait_for: result[0] contains interface register: output It fixes the problem which exists with both arubaoss_command (HP) and aruba_command (community) modules. It could be it comes from the paramiko ssh client.

Hello, i agree, for some reason wait_for help also in my case. It looks like some timeout appear in case of slower response...Thank @Catchestherust for a hint.

- hosts: all
  vars:
    ansible_connection: network_cli
    ansible_python_interpreter: ./env/bin/python
  gather_facts: False
  tasks:
    - name: Execute show run on the switchs
      arubaoss_command:
        commands: ['show vlan 1102']
        wait_for: result[0]  contains VLAN
        output_file: "{{ inventory_hostname }}.jumbo"
Catchestherust commented 3 years ago

I made some tests since I wrote my last comment. The problem I had before applying the workaround was that I got an answer around every 10 attempts. Since I applied the workaround, I get an answer at every try, but I get 2 identical answers around every 10 attempts. You can accommodate that (when possible) by keeping only one answer from the output of the command, but that's not what one could expect from a module. Better than nothing.

mehransaeed7810 commented 1 year ago

Hello Guys, My playbook doesn't run. no matter what i change doesn't accept the module. following is my playbook. can someone review the playbook and advise on if I am doing something wrong.