problem copy/template module with edgerouter

I want to configure some of edgerouters with ansible
one of the tasks is send a user`s public key then config authenticate with that key
the task is quite simple
but I found although the tasks runs successfully , but the file does not show on edgerouter

  • name: “Copy SSH public key to router”
    copy:
    src: “usera.pub”
    dest: “/tmp/usera.pub”

and also I try to generate file by using templates , the same situation, tasks runs ok , but destination file does not exists.

ans here is the playbook

  • hosts: all
    become: True
    become_user: root
    become_method: sudo
    connection: network_cli
    gather_facts: no
    vars:
  • role_users: “{{ technical_users }}”
  • server_location: hq
  • ansible_network_os: edgeos
  • ansible_connection: network_cli
  • ansible_become: yes
  • ansible_become_method: enable

roles:

  • { role: hosts, tags: hosts }
  • { role: edgerouter , tags: edgerouter }

any suggestions ?

I don't know anything about edgerouters (if that is a brand) but most routers and switches don't have Python so modules using Python will not work and that includes copy and template module.
Most routers switches do have there own modules that utilize the network_cli connection plugin.
https://docs.ansible.com/ansible/latest/modules/list_of_network_modules.html

So if it not on the list you are most likely left with the expect module to interact with the router.

You can try with net_put modulehttps://docs.ansible.com/ansible/latest/modules/net_put_module.html