Make Kubespray install work without --private-key too

It seems the ansible_ssh_private_key_file variable is only defined
when --private-key parameter is passed to the main deployment Ansible
run. This is always true for deploying via tripleoclient and Mistral,
but may not be true when deploying via manual ansible-playbook
execution.

We now check whether the variable is defined before using it. If it's
not defined, user's default ssh key will be used for trying to connect
to the overcloud nodes.

Change-Id: Id04d3bab85713d644899694231dd4009a88385af
This commit is contained in:
Jiri Stransky 2017-12-05 11:51:32 +01:00 committed by Steven Hardy
parent f253c0d08d
commit ac6c11f7aa
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ outputs:
-i '{{playbook_dir}}/kubespray/inventory.yml'
--skip-tags docker,bastion-ssh-config
--extra-vars '@{{playbook_dir}}/kubespray/global_vars.yml'
--private-key '{{ansible_ssh_private_key_file}}'
{% if ansible_ssh_private_key_file is defined %}--private-key '{{ansible_ssh_private_key_file}}'{% endif %}
'{{playbook_dir}}/kubespray/playbook.yml'
{%- endif -%}
- name: print kubespray command