I found this SO post about copying files between nodes with ansible. Here's the ansible task:
- name: Copy Pipeline files
synchronize: mode=pull src=/home/ec2-user/nlp/nlp_test/all_data/test/ dest=/opt/nlp-ml/rate/Pipeline dirs=yes
delegate_to: "{{ ml_ip }}"
I tried it out with my playbook but it failed with the message:
msg: Warning: Identity file /Users/me/me.pem not accessible: No such file or directory.
Permission denied (publickey).
This makes sense as my identity file is stored locally and not on a remote machine. However, the source node's public key has been distributed to the target node. How can I get around this?
Edit: I tried adding the destination node's public key to the source node. I then added use_ssh_args=yes
to the synchronize task. After that I added ssh_args = -i /home/ec2-user/.ssh/id_rsa
(the location of the private key on both the source and destination nodes) to ansible.cfg. Same issue.