How to copy ssh key to remote host using Ansible.

---- name: Copy SSh Key | copying shh key to remote host  authorized_key:     user: "<your_user>"     state: present     key: "{{ lookup('file', item) }}"  with_fileglob:  - id_dsa.pub  become: true
---- include: ssh-key-copy/main.yaml  become: yes
---- name: copying ssh key and updating sudoershosts: <host_target_group_name>gather_facts: falsebecome: trueremote_user: <the user with which you wants to perform the operation>roles:  - ssh-key-copy

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store