Developer

last person joined: 8 days ago 

Expand all | Collapse all

Aruba SSH/CLI Module

This thread has been viewed 5 times
  • 1.  Aruba SSH/CLI Module

    Posted Sep 17, 2019 09:15 PM

    Hello, 

     

     

     

    I am very new to Ansible and wondering if someone can look into this. 

     

    I have installed the Python and Ansible as per the https://github.com/aruba/aruba-ansible-modules and videos "Aruba Bots Ansible Series 01 - 03". I can connect to the switch using the ansible modules. Please see the outupt below.

     

    +++++++++++++++++++++++++++++++++++++++++++++

    python --version

    Python 2.7.16

    MacBook-Pro:arubaoss tarun$ ansible --version

    ansible 2.8.5

      config file = None

      configured module search path = ['/Users/tarun/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']

      ansible python module location = /usr/local/Cellar/ansible/2.8.5/libexec/lib/python3.7/site-packages/ansible

      executable location = /usr/local/bin/ansible

      python version = 3.7.4 (default, Sep  7 2019, 18:27:02) [Clang 10.0.1 (clang-1001.0.46.4)]

     

    MacBook-Pro:arubaoss tarun$ ansible-playbook system_attributes.yml -i switch_hosts.yml 

     

    PLAY [switch1] ***********************************************************************************************************************************************************************

     

    TASK [Gathering Facts] ***************************************************************************************************************************************************************

    ok: [switch1]

     

    TASK [Update Switch System Attributes] ***********************************************************************************************************************************************

    changed: [switch1]

     

    PLAY RECAP ***************************************************************************************************************************************************************************

    switch1                    : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

     

    MacBook-Pro:arubaoss $ 

     

    +++++++++++++++++++++++++++++++++++++++++++++

     

     

    However I am unable to use the SSH/CLI module as mentioned in the Aireheads community https://community.arubanetworks.com/t5/Developer-Community/How-to-install-use-CLI-modules-and-tasks-for-Switch-and-CX-in/td-p/534333/highlight/false

     

     

    ++++++++++++++++++++++++++++++++++++++++++

     

    $ansible-playbook cli-test.yml -i switch_hosts.yml

    ERROR! 'arubaos_switch_ssh_cli' is not a valid attribute for a Play

     

    The error appears to have been in '/home/tarun/aruba-ansible-modules/example_playbooks/arubaoss/cli-test.yml': line 1, column 3, but may

    be elsewhere in the file depending on the exact syntax problem.

     

    The offending line appears to be:

     

     

    - name: Check if upload is completed

      ^ here

     

    cat cli-test.yml

    - name: Check if upload is completed

      arubaos_switch_ssh_cli:

        ip: 10.0.0.254

        user: netadmin

        password: netadmin

        # This will execute each command through the CLI and return the CLI Output

        show_command: ["show flash", "show version"]

      # The result will have the CLI Output

     

    +++++++++++++++++++++++++++++++++++++++++



  • 2.  RE: Aruba SSH/CLI Module

    Posted Sep 18, 2019 12:48 PM

    Hi tarunagghi!

     

    Did you copy the library/ directory from the aruba-switch-ansible Github to the directory where your playbook cli_test.yml is? That should be step 2 of How to install/use CLI modules and tasks for Switch and CX in Ansible

     

    If you did, I would double check your indentation, some times that could throw an error, but I doubt that's the case here.

     

    Could you please re-run the playbook in verbose mode? Just append -vvvv to the end of the execution and reply with the results of the failure. So your execution command should look like this:

    ansible-playbook cli-test.yml -i switch_hosts.yml -vvvv


  • 3.  RE: Aruba SSH/CLI Module

    Posted Sep 18, 2019 07:57 PM
      |   view attached

    Yes, I did copy the library and like you mentioned it was the indentation. I double-check and corrected my indentation and it's working now. I copied it to the ssh_working.yml 

     

    I have attached the screenshot of the working indentation if someone has the same issue.