This exception appears to affect ansible when a playbook is executed from a host with several identities configured in the SSH agent (Tested on a development machine with 12 private keys).
I've noted this exception to be particulary common with AWS targets
Most tasks will run fine when we configure our inventory to use a specific private key.
We also need to set the IdentitiesOnly
flag so that ssh does not attempt other authentication strategies.
# inventory
example.com ansible_ssh_private_key_file=/a/b/key.pem ansible_ssh_extra_args="-o IdentitiesOnly=yes"
synchronize
tasks will require an additional flag:
use_ssh_args
needs to be set to include ssh arguments from the inventory when running rsync
- name: copy code
synchronize:
src: "<source>"
dest: "<destination>"
use_ssh_args: yes
tags:
- code
Thanks !