I have synchronize playbook but show error message
this my playbook
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: push local folder to remote host
synchronize:
src: /tmp/client/
dest: /tmp/test/
mode: push
rsync_opts: ‘-e “ssh -i /home/ubuntu/.ssh/xxx.pem” unbuntu@xx.xx.xx.xx:/tmp/test/’
delegate_to: xxx.xxx.xxxx
run playbook show error message , I have path xxx.pem I can ssh access,can help
thanks.
TASK [push local folder to remote host] **************************************************************************************************
task path: /home/ubuntu/aws-efs/sync.yml:7
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/files/synchronize.py
<xxx.xxxx> ESTABLISH SSH CONNECTION FOR USER: None
<xxx.xxx> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/1eadf75351 xxx.xx.xx ‘/bin/sh -c ‘"’“‘echo ~ && sleep 0’”’"‘’
(255, ‘’, ‘root@xx.xx.x.x: Permission denied (publickey).\r\n’)
fatal: [localhost]: UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: root@xx.xx.xx.xx: Permission denied (publickey).\r\n”,
“unreachable”: true
}
to retry, use: --limit @/home/ubuntu/aws-efs/sync.retry