aruba / aos-switch-ansible-collection

Ansible collection for AOS-Switch switches
67 stars 19 forks source link

arubaoss_command cannot catch exceptions (for example if switch is down) #31

Open okin8 opened 2 years ago

okin8 commented 2 years ago

if switch is not reachable it is still reported as OK. In this simplest example I have a non-existing switch with 1.1.1.1 in inventory.

Ansible reports as task was executed OK.

sa@m1 ansible % ansible-playbook -i inv-aruba.ini pb-aruba.yml

PLAY [all] **************************************************************************************

TASK [Execute show run on the switch] ***********************************************************
ok: [Aruba2930-LAB]

PLAY RECAP **************************************************************************************
Aruba2930-LAB              : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

sa@m1 ansible %  cat inv-aruba.ini 
[lab]
Aruba2930-LAB ansible_host=1.1.1.1 ansible_user=manager ansible_password=password12 ansible_network_os=arubanetworks.aos_switch.arubaoss ansible_connection=network_cli
sa@m1 ansible % cat pb-aruba.yml 
---
# SSH CLI Access - 
# https://galaxy.ansible.com/arubanetworks/aos_switch
- hosts: all
  gather_facts: false
  collections:
    - arubanetworks.aos_switch
  vars:
    ansible_connection: network_cli
    ansible_network_os: arubanetworks.aos_switch.arubaoss

  tasks:
    - name: Execute show run on the switch
      arubaoss_command:
        commands: ['show run']
sa@m1 ansible % 
tchiapuziowong commented 2 years ago

We're utilizing Ansible's netcommon library to build our SSH connection - this appears to be an issue with that dependency which restricts our ability to resolve this within Aruba's code - we're still investigating this internally and we've included this as a dependent issue in Ansible's open issue for the same behavior here: https://github.com/ansible-collections/ansible.netcommon/issues/340

okin8 commented 2 years ago

why I don't similar issues with Cisco collection? Both are using same network_cli