access to ansible_ssh_host and ansible_ssh_port in a play

Hi,

Is it possible to access ansible_ssh_host (and other inventory parameters) in a playbook ?
The goal is to copy/backup files from a remote machine to the local ansible station or a machine specified with delegate_to using rsync over ssh. So i would need to expand the ssh connection info in the command.

Or is an action plugin the only way to make this kind of functionality possible ?

Thanks,
Stefan

yes you can use hostvars, hostvars[host][‘ansible_ssh_host’] replacing host with the host you want to get in info on.

also ansible_ssh_host is available as a variable for the current play host, you can simply do {{ ansible_ssh_host }}