# Unable to copy IOS Image from ansbile to aruba Swtich

**URL:** <https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864>\
**Category:** Get Help\
**Tags:** arubanetworks\
**Created:** [October 23, 2023, 7:15am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864 "2023-10-23T07:15:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![G24joshi](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@G24joshi](https://forum.ansible.com/u/G24joshi)\
**Post date:** [October 23, 2023, 7:15am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/1 "2023-10-23T07:15:24Z")

</div>

Hi,

I am trying to copy an IOS Image from ansible server (my ansible Server is working as TFTP server) to aruba switch, but I am getting below Error. I am trying to achieve this using module “community.network.aruba\_command:”.

Could you please tell me the right module to copy as I am unable to find that also.

## Playbook

## [root@lonans01 arubaymls]# cat copy-ansible-to-switch.yml

- hosts: arubaswitch  
gather\_facts: no  
vars:  
ansible\_command\_timeout: 2000

* * *

## and error:

[root@lonans01 arubaymls]# ansible-playbook copy-ansible-to-switch.yml  
[DEPRECATION WARNING]: [defaults]callback\_whitelist option, normalizing names to new standard, use callbacks\_enabled instead. This feature will be removed  
from ansible-core in version 2.15. Deprecation warnings can be disabled by setting deprecation\_warnings=False in ansible.cfg.  
[WARNING]: Skipping callback plugin ‘jsnapy’, unable to load

PLAY [arubaswitch] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Copy ISO Image from ansible to Aruba Switch] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
[WARNING]: ansible-pylibssh not installed, falling back to paramiko  
fatal: [57.6.141.46]: FAILED! =\> {“changed”: false, “msg”: “Unsupported parameters for (community.network.aruba\_command) module: answer, prompt. Supported parameters include: port, host, timeout, match, wait\_for (waitfor), ssh\_keyfile, username, password, retries, commands, interval.”}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
57.6.141.46 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

## [root@lonans01 arubaymls]#

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [October 23, 2023, 7:58am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/2 "2023-10-23T07:58:29Z")

</div>

Hello @G24joshi ,

You’re either including non existing parameters to the `community.network.aruba_command` module or non existent keywords to the task (hard to say if it’s one way or the other with the unformatted code). Check out the docs:

[https://docs.ansible.com/ansible/latest/collections/community/network/aruba\_command\_module.html](https://docs.ansible.com/ansible/latest/collections/community/network/aruba_command_module.html)

Also, the `vars_prompt` [keyword](https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html) only exists at a play level. If what you wanted is to add prompts to your playbook you should add them to the playbook section (on top):

[https://docs.ansible.com/ansible/latest/playbook\_guide/playbooks\_prompts.html](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_prompts.html)

Here is an example of using the `vars_prompt` keyword at a play level (you cannot use it at a task level):

```yaml
---
- name: My Playbook
  hosts: arubaswitch
  gather_facts: false
  vars:
    ansible_command_timeout: 2000
  vars_prompt:
    - name: continue
      prompt: "Continue (y/n)?"
  tasks:

    - name: Copy ISO Image from ansible to Aruba Switch
      community.network.aruba_command:
        commands: "copy tftp flash 10.160.106.49 WC_16_08_0006.swi secondary"
      when: continue == 'y'
...

```

PS: There is also the `ansible.builtin.expect` module, but it only does allow you to execute shell commands… I guess it won’t be of use to you on this context:

[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/expect_module.html)

Hope it helps!

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [October 23, 2023, 8:51am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/3 "2023-10-23T08:51:39Z")

</div>

I failed to see this:

> [@G24joshi](#):
>
> Could you please tell me the right module to copy as I am unable to find that also.

You might use the `ansible.builtin.command` to run `scp`, for example. Or even better, as you want to add prompts, you might try the `ansible.builtin.expect` module to run the `scp` command

Or you also could try the `ansible.builtin.copy` module:

[ansible.builtin.copy module – Copy files to remote locations — Ansible Documentation](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html)

---

<div class="post-metadata">

**Author:** ![G24joshi](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@G24joshi](https://forum.ansible.com/u/G24joshi)\
**Post date:** [October 23, 2023, 9:23am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/4 "2023-10-23T09:23:24Z")

</div>

Hi @jbericat ,

Thanks for your reply.

If we executed command “copy tftp flash 10.160.106.49 WC\_16\_08\_0006.swi secondary” manually over the Aruba Switch it prompts “Continue (y/n)?” and after typing “y” it starts getting copy.

## So if we want to do this task from the ansible playbook, then how we can type “y” to Continue.

For your reference I achieved the same thing with Cisco Switch via below Playbook. here you will see I used prompt.

* * *

- hosts: cisco6800  
gather\_facts: no  
vars:  
ansible\_command\_timeout: 1800  
vars\_prompt:
  - name: file1  
prompt: Please enter the filename.  
private: false  
tasks:
  - name: COPY FROM Switch to Ansible  
ios\_command:  
commands:  
- command: copy tftp://10.160.106.49/{{ file1 }} bootdisk:/{{ file1 }}  
prompt: ‘[{{ file1 }}]’  
answer: “\r”

* * *

If possible can you please tell me what would be the right module to copy

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [October 23, 2023, 10:33am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/5 "2023-10-23T10:33:19Z")

</div>

> [@G24joshi](#):
>
> here you will see I used prompt.
> 
> * * *

That’s because the `cisco.ios.ios_command` module actually accepts those attributes on the `command` parameter. Check-out the docs:

[https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios\_command\_module.html](https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_command_module.html)

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/1/137b4da711036b3193cb67a9c2fced65e80d0171.png)

Anyway, I just had a wild idea… Have you tried this?

```yaml
    - name: Copy ISO Image from ansible to Aruba Switch
      community.network.aruba_command:
        commands: 
          - "copy tftp flash 10.160.106.49 WC_16_08_0006.swi secondary"
          - "y"

```

Cheers

---

<div class="post-metadata">

**Author:** ![G24joshi](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@G24joshi](https://forum.ansible.com/u/G24joshi)\
**Post date:** [October 24, 2023, 8:55am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/6 "2023-10-24T08:55:39Z")

</div>

Hi @jbericat

I just tried this and now getting error “Internal error”. Please find below output with -vvvv.

TASK [Copy ISO Image from ansible to Aruba Switch] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /root/arubaymls/copy-ansible-to-switch-v2.yml:9  
redirecting (type: connection) ansible.builtin.network\_cli to ansible.netcommon.network\_cli  
Loading collection ansible.netcommon from /root/.ansible/collections/ansible\_collections/ansible/netcommon  
Loading collection ansible.utils from /root/.ansible/collections/ansible\_collections/ansible/utils  
Loading collection arubanetworks.aos\_switch from /root/.ansible/collections/ansible\_collections/arubanetworks/aos\_switch  
redirecting (type: become) ansible.builtin.enable to ansible.netcommon.enable  
\<57.6.141.46\> attempting to start connection  
\<57.6.141.46\> using connection plugin ansible.netcommon.network\_cli  
Found ansible-connection at path /usr/local/bin/ansible-connection  
\<57.6.141.46\> local domain socket does not exist, starting it  
\<57.6.141.46\> control socket path is /root/.ansible/pc/85afccfd3e  
\<57.6.141.46\> redirecting (type: connection) ansible.builtin.network\_cli to ansible.netcommon.network\_cli  
\<57.6.141.46\> Loading collection ansible.netcommon from /root/.ansible/collections/ansible\_collections/ansible/netcommon  
\<57.6.141.46\> Loading collection ansible.utils from /root/.ansible/collections/ansible\_collections/ansible/utils  
\<57.6.141.46\> Loading collection arubanetworks.aos\_switch from /root/.ansible/collections/ansible\_collections/arubanetworks/aos\_switch  
\<57.6.141.46\> local domain socket listeners started successfully  
\<57.6.141.46\> loaded cliconf plugin ansible\_collections.arubanetworks.aos\_switch.plugins.cliconf.arubaoss from path /root/.ansible/collections/ansible\_collections/arubanetworks/aos\_switch/plugins/cliconf/arubaoss.py for network\_os arubanetworks.aos\_switch.arubaoss  
\<57.6.141.46\> ssh type is set to auto  
\<57.6.141.46\> autodetecting ssh\_type  
[WARNING]: ansible-pylibssh not installed, falling back to paramiko  
\<57.6.141.46\> ssh type is now set to paramiko  
\<57.6.141.46\>  
\<57.6.141.46\> local domain socket path is /root/.ansible/pc/85afccfd3e  
redirecting (type: modules) community.network.aruba\_command to community.network.network.aruba.aruba\_command  
\<57.6.141.46\> Using network group action community.network.aruba for community.network.aruba\_command  
\<57.6.141.46\> ANSIBLE\_NETWORK\_IMPORT\_MODULES: enabled  
redirecting (type: modules) community.network.aruba\_command to community.network.network.aruba.aruba\_command  
\<57.6.141.46\> ANSIBLE\_NETWORK\_IMPORT\_MODULES: found community.network.aruba\_command at /usr/local/lib/python3.8/site-packages/ansible\_collections/community/network/plugins/modules/network/aruba/aruba\_command.py  
\<57.6.141.46\> ANSIBLE\_NETWORK\_IMPORT\_MODULES: running community.network.aruba\_command  
\<57.6.141.46\> ANSIBLE\_NETWORK\_IMPORT\_MODULES: complete  
fatal: [57.6.141.46]: FAILED! =\> {  
“changed”: false,  
“invocation”: {  
“module\_args”: {  
“commands”: [  
“copy tftp flash 10.160.106.49 WC\_16\_08\_0006.swi secondary”,  
“y”  
],  
“host”: null,  
“interval”: 1,  
“match”: “all”,  
“password”: null,  
“port”: null,  
“retries”: 10,  
“ssh\_keyfile”: null,  
“timeout”: null,  
“username”: null,  
“wait\_for”: null  
}  
},  
“msg”: “Internal error”,  
“rc”: -32603  
}

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [October 24, 2023, 11:56am UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/7 "2023-10-24T11:56:48Z")

</div>

meh I was hoping it did… Well, I would like to have a look to the Aruba docs before digging further. Can you paste a show version of the node, pls?

---

<div class="post-metadata">

**Author:** ![G24joshi](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@G24joshi](https://forum.ansible.com/u/G24joshi)\
**Post date:** [October 24, 2023, 12:55pm UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/8 "2023-10-24T12:55:48Z")

</div>

Thanks a lot @jbericat

## I have achieved this task by my below playbook.

```
- name: image upload
  ansible.netcommon.cli_command:
      command: copy tftp flash 10.160.106.49 {{ file1 }} secondary
      prompt: Continue (y/n)?
      answer: y
      newline: false

```

* * *

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [October 24, 2023, 2:01pm UTC](https://forum.ansible.com/t/unable-to-copy-ios-image-from-ansbile-to-aruba-swtich/1864/9 "2023-10-24T14:01:42Z")

</div>

Great @G24joshi! Thanks for sharing your fix btw 🙂

Cheers
