Copy files between nodes with ansible -


i found this post copying files between nodes ansible. here's 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 out playbook failed message:

msg: warning: identity file /users/me/me.pem not accessible: no such file or directory. permission denied (publickey). 

this makes sense identity file stored locally , not on remote machine. however, source node's public key has been distributed target node. how can around this?

edit: tried adding destination node's public key source node. added use_ssh_args=yes synchronize task. after added ssh_args = -i /home/ec2-user/.ssh/id_rsa (the location of private key on both source , destination nodes) ansible.cfg. same issue.

so in order requires combination of things tried. @vvchik suggested try removing mode=pull, didn't work initially. however, when combined use_ssh_args, able working. full solution, here is:

generate ssh key on source node (in default location , without password) , install on destination nodes. add task:

- name: copy files source destination   synchronize: src=source dest=destination dirs=yes use_ssh_args=yes   delegate_to: "{{ source_ip }}" 

finally, in ansible.cfg add ssh_args = -i /home/user/.ssh/id_rsa. ansible.cfg should in current directory.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -