# Specifying ssh key for delegate\_to target

**URL:** <https://forum.ansible.com/t/specifying-ssh-key-for-delegate-to-target/24915>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 4:03pm UTC](https://forum.ansible.com/t/specifying-ssh-key-for-delegate-to-target/24915 "2017-07-06T16:03:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gin](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gin](https://forum.ansible.com/u/Gin)\
**Post date:** [July 6, 2017, 4:03pm UTC](https://forum.ansible.com/t/specifying-ssh-key-for-delegate-to-target/24915/1 "2017-07-06T16:03:09Z")

</div>

Hi,

I am trying to provision a couple of hosts:  
`  
[masters]  
master-1

[nodes]  
node-1  
`

Each host has an individual private key used to ssh to that particular server. I define ansible\_ssh\_private\_key\_file and store private keys on localhost:

`"./deployment/{{inventory_hostname}}/id_rsa"`

In this example, there are two keys at the following locations:  
`./deployment/master-1/id_rsa ./deployment/node-1/id_rsa`

I would like to execute a slurp task while on node-1. The task reads the contents of a file that resides on master-1:

`

- name: Read remote  
slurp:  
src: “/remote/file”  
register: remote\_value  
run\_once: true  
delegate\_to: “{{ groups[‘masters’][0] }}”  
`

At the moment the task fails saying it is unable to ssh to master-1. And that is correct, considering that ansible\_ssh\_private\_key\_file is resolved to “…/node-1/id\_rsa”.  
How can I specify private key location for delegate\_to: master-1 (…/master-1/id\_rsa)?

Thanks,  
Gintas
