Tasks export keys

Good afternoon everyone, I have a problem because I couldn’t find a similar task to validate mine. I want to export the public key to some machines. I appreciate your attention and help if anyone has already done or gone through the same thing. Below is an example of what I’m trying. Thank you.


  • name: Ansible Checksum, Backup, Validate
    hosts: hosts01
    tasks:
    #Checksum
    • name: Deploy WAR file to Tomcat
      copy:
      src: ~/home/vagrant/.ssh/id_rsa.pub
      dest: /home/root/.ssh
      checksum: “{{ lookup(‘file’, ‘~/home/vagrant/.ssh/id_rsa.pub’) | hash(‘sha256’) }}”
      become: true

Have you checked the authorized_keys module?