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