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.
hosts: arubaswitch
gather_facts: no
vars:
ansible_command_timeout: 2000
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”
prompt:
“Continue (y/n)?”
answer: ‘y’
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.”}
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:
Also, the vars_promptkeyword 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):
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:
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:
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:
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
}