Developer

 View Only
last person joined: 6 days ago 

Expand all | Collapse all

Unable to upload image on AOS switch(2930M) with Ansible

This thread has been viewed 25 times
  • 1.  Unable to upload image on AOS switch(2930M) with Ansible

    Posted Jan 24, 2022 09:44 AM
    Dear All

    I'm using a simple playbook for uploading firmware image to 2930M using cli.

    ---
    - hosts: all
    collections:
    - arubanetworks.aos_switch
    vars:
    ansible_connection: network_cli
    tasks:
    - name: image upload
    arubaoss_command:
    commands: ["copy tftp flash 10.0.0.100 WC_16_10_0019.swi secondary"]
    register: result
    - debug: var=result

    The playbook runs without "failed" but the image upload is not working at all. 
    If I run the command on the switch itself, "copy tftp flash 10.0.0.100 WC_16_10_0019.swi secondary" is working completely fine from the switch and there is no firewall blocking the traffic between the switch and TFTP on my laptop.
    I've attached the debug file.
    Does anybody know what I miss or did wrongly?

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TASK [debug] *****************************************************************************************************************************************************************************************************************************
    task path: /etc/ansible/firmware_upgrade.yml:12
    redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
    Loading collection ansible.netcommon from /home/mko/.ansible/collections/ansible_collections/ansible/netcommon
    <10.0.0.1> attempting to start connection
    <10.0.0.1> using connection plugin ansible.netcommon.network_cli
    Found ansible-connection at path /usr/bin/ansible-connection
    <10.0.0.1> found existing local domain socket, using it!
    <10.0.0.1> invoked shell using ssh_type: paramiko
    <10.0.0.1> ssh connection done, setting terminal
    <10.0.0.1> loaded terminal plugin for network_os arubanetworks.aos_switch.arubaoss
    <10.0.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
    <10.0.0.1> firing event: on_open_shell()
    <10.0.0.1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
    <10.0.0.1> ssh connection has completed successfully
    [ERROR]: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 699, in recv out = self.in_buffer.read(nbytes, self.timeout) File "/usr/lib/python3/dist-
    packages/paramiko/buffered_pipe.py", line 164, in read raise PipeTimeout() paramiko.buffered_pipe.PipeTimeout During handling of the above exception, another exception occurred: Traceback (most recent call last): File
    "/home/mko/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py", line 994, in send response = self.receive( File
    "/home/mko/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py", line 945, in receive response = self.receive_paramiko( File
    "/home/mko/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py", line 759, in receive_paramiko data = self._ssh_shell.recv(256) File "/usr/lib/python3/dist-packages/paramiko/channel.py",
    line 701, in recv raise socket.timeout() socket.timeout
    <10.0.0.1> updating play_context for connection
    <10.0.0.1>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

    Best regards,

    Attachment(s)

    txt
    debug.txt   12 KB 1 version
    txt
    ansible.cfg.txt   69 B 1 version
    txt
    firmware_upgrade.yml.txt   299 B 1 version
    txt
    inventory.yml.txt   216 B 1 version


  • 2.  RE: Unable to upload image on AOS switch(2930M) with Ansible

    MVP GURU
    Posted Jan 24, 2022 03:00 PM
    it look a issue with paramiko to connect to the switch...

    if you try to connect to the switch with paramiko it is working ?


    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: Unable to upload image on AOS switch(2930M) with Ansible

    Posted Jan 24, 2022 04:23 PM
    Dear Alagotte

    Thank you for your reply.
    I'm a beginner who just dived into the automation world not familiar with any other automation tool.
    I just want to try Ansible first because it's much simpler than python.
    I have tried to make a paramiko test run as attached.
    I'm not sure this is what you think.
    This python script is running without error but no actual config change is seen on the switch.
    Could you help me out here?


    =================================================================
    import paramiko
    import time

    ip_address = "10.0.0.1"
    username = "manager"
    password = "manager"

    ssh_client = paramiko.SSHClient()
    ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh_client.connect(hostname=ip_address,username=username,password=password)

    remote_connection = ssh_client.invoke_shell()
    remote_connection.send("configure terminal\n")
    remote_connection.send("int loop 1\n")
    remote_connection.send("ip address 2.2.2.2\n")
    remote_connection.send("end\n")

    time.sleep(1)
    output = remote_connection.recv(65535)

    ssh_client.close
    ====================================================================

    Original Message:
    Sent: Jan 24, 2022 02:59 PM
    From: Alexis La Goutte
    Subject: Unable to upload image on AOS switch(2930M) with Ansible

    it look a issue with paramiko to connect to the switch...

    if you try to connect to the switch with paramiko it is working ?


    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281