copying bin file from ansible control server to switch

Hi team,

Can you please provide me the module to copy the IOS image file to cisco switch?

I used below but it prompts for password

  • name: COPY OVER IOS IMAGE

command: “scp system-image-filename.bin {{inventory_hostname}}:/system-image-filename.bin”

  • name: SET BOOT SYSTEM FLASH
    ios_config:
    commands:
  • “boot system flash:system-image-filename.bin”

I am getting below error

“msg”: “Exception received : Administratively disabled.\n”

my playbook is

  • name: Copying file from Ansible
    net_put:
    src: /home/testuser/ansible/from_ansible.text

  • name: copying IOS image to cisco switch
    net_put:
    src: /home/testuser/ansible/from_ansible.text
    protocol: tftp
    dest: flash:/from_ansible.text

Based on a quick GOogle search that gives https://community.cisco.com/t5/network-management/distribute-sw-images-through-scp-failed/td-p/706491 , this sounds more like a Cisco config issue than an Ansible one.

Richard.

Great thanks