aruba / aos-switch-ansible-collection

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

arubaoss_file_transfer - SSH command execution is not supported #78

Open bsiefers opened 1 year ago

bsiefers commented 1 year ago

Hi, I am trying to run a firmware update for a hp Aruba server. I am running into a issue where non-interactive ssh commands are not supported. I receive the message "SSH command execution is not supported" as a result.

This is what my play looks like.

---
- hosts: "{{ hosts }}"
  name: Download Firmware Image To Hosts And Reboot
  collections:
    - arubanetworks.aos_switch
  tasks:
    - name: Upgrade Firmware via SSH CLI
      arubaoss_file_transfer:
          file_url: "https://{{http_server}}/firmware/KB_16_11_0004.swi"
          file_type: "FTT_FIRMWARE"
          boot_image: "BI_SECONDARY_IMAGE"
          action: "FTA_DOWNLOAD"

Is there any support for non-ssh usage, or using the interactive shell? Let me know if you know of any ways to get around this issue. Thanks!

alagoutte commented 1 year ago

Hi,

What the actual firmware on switch ?

Do you have try with HTTP for download ?

bsiefers commented 1 year ago

The switch is: HP J9850A Switch 5406Rzl2 Software revision KB.16.11.0012

We are open to any alternatives that would work within ansible.

tchiapuziowong commented 1 year ago

Hi @bsiefers what you're trying to use is a REST API module - is your ansible_connection: local?

To use SSH to execute CLI commands you'll want to use the arubaoss_command module and set the ansible_connection: network_cli

Here's an example playbook:

- hosts: all
  collections:
    - arubanetworks.aos_switch
  gather_facts: False
  vars:
    ansible_connection: network_cli        
  tasks:
    - name: Copy Image to Switch via TFTP
      arubaoss_command:
        commands:
          - command: "copy tftp flash 10.80.2.153 WC_16_11_0013.swi secondary oobm"
            check_all: true
            prompt:
              - '.*\(y\/n\)\?.*'
            answer:
              - 'y'

    - name: Copy Image to Switch via SFTP
      arubaoss_command:
        commands:
          - command: "copy sftp flash administrator@10.80.2.153 WC_16_11_0013.swi secondary oobm"
            check_all: true
            prompt:
              - '.*\(y\/n\)\?.*'
              - '.*password\?.*'
            answer:
              - 'y'
              - 'password'