Hi Michael, have you tried setting the key option via the rsync_opts and/or rsync_path parameters to synchronize module?
On Sat, Feb 7, 2015 at 10:05 AM, Michael Spiegle <[email protected]> wrote: > I have a simple task to copy a file from one path to another on a remote > host. I need a private key to SSH into the remote host, but the > synchronize module automatically uses my private key in the rsync command > too which seems unnecessary: > > ansible-playbook --private-key=keys/mykey.pem playbook.yml --tags= > 'main,role-timezone-set-localtime' -vvvv > > ... some ansible output ... > TASK: [timezone | set /etc/localtime to UTC] > ********************************** > (redacted output) > > failed: [remote_machine -> remote_machine] => {"cmd": "rsync > --delay-updates -FF --compress --checksum --archive --rsh 'ssh -i > keys/mykey.pem -S none -o StrictHostKeyChecking=no' > --out-format='<<CHANGED>>%i %n%L' \"[email protected]:/usr/share/zoneinfo/UTC\" > \"/etc/localtime\"", "failed": true, "rc": 255} > > msg: Warning: Identity file keys/mykey.pem not accessible: No such file or > directory. > ssh: connect to host 1.2.3.4 port 22: Connection timed out > rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] > rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9] > > In the above, you can see that the rsync process running on the remote > machine is trying to use an ssh private key to log into itself, but that > key only exists on my laptop where I'm running Ansible from. Here's what > my task looks like (I tried nulling the private_key to no avail): > > - name: set /etc/localtime to {{timezone}} > > synchronize: > > src: "{{tzfile}}" > > dest: /etc/localtime > > mode: pull > > times: yes > > checksum: yes > > private_key: "" > > delegate_to: "{{inventory_hostname}}" > > tags: role-timezone-set-localtime > > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2d473d23-d164-4fc1-9b3a-5d051e179836%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/2d473d23-d164-4fc1-9b3a-5d051e179836%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAMFyvFipXicpZBzNUvgi2Lk05xRNr2idL6p%3Dw5%2B68q5ENBwUTQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
