diff --git a/playbooks/ceph.yml b/playbooks/ceph.yml index 0a2bea363b..e39dad303d 100644 --- a/playbooks/ceph.yml +++ b/playbooks/ceph.yml @@ -58,7 +58,7 @@ - name: Distribute SSH keypair to target nodes tags: admin - hosts: "{{ cifmw_ceph_target | default('computes') }}" + hosts: "{{ cifmw_ceph_target | default('computes') }}" gather_facts: false become: true vars: @@ -265,7 +265,12 @@ gather_facts: false vars: _target_hosts: "{{ groups[cifmw_ceph_target | default('computes')] | default([]) }}" - ansible_ssh_private_key_file: "{{ lookup('env', 'ANSIBLE_SSH_PRIVATE_KEY') }}" + _target: "{{ _target_hosts | first }}" + ansible_ssh_private_key_file: >- + {{ + hostvars[_target]['ansible_ssh_private_key_file'] | + default(lookup('env', 'ANSIBLE_SSH_PRIVATE_KEY')) + }} cifmw_cephadm_spec_ansible_host: /tmp/ceph_spec.yml cifmw_cephadm_bootstrap_conf: /tmp/initial_ceph.conf cifmw_ceph_client_vars: /tmp/ceph_client.yml