From 0e6703a322199115b3c894868abb900e27f2c669 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Tue, 11 Jun 2019 16:01:03 +0100 Subject: [PATCH] Use BatchMode to check whether host is accessible via SSH If password authentication is not disabled on the server, we may be prompted for a password if the Kayobe Ansible user doesn't exist or isn't configured for passwordless authentication. By using BatchMode, the ssh command can fail quickly and proceed to create the Kayobe Ansible user using the bootstrap user. Change-Id: If22ed34dc4b6e87f8cf76c302948c955bddf2bc5 --- ansible/kayobe-ansible-user.yml | 2 +- releasenotes/notes/ssh-batchmode-cda7a4ed63006378.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/ssh-batchmode-cda7a4ed63006378.yaml diff --git a/ansible/kayobe-ansible-user.yml b/ansible/kayobe-ansible-user.yml index 8b5c6990a..956d7f750 100644 --- a/ansible/kayobe-ansible-user.yml +++ b/ansible/kayobe-ansible-user.yml @@ -14,7 +14,7 @@ tasks: - name: Check whether the host is accessible via SSH local_action: - module: command ssh -p {{ ssh_port }} {{ ssh_user }}@{{ ssh_host }} hostname + module: command ssh -o BatchMode=yes -p {{ ssh_port }} {{ ssh_user }}@{{ ssh_host }} hostname failed_when: false changed_when: false register: ssh_result diff --git a/releasenotes/notes/ssh-batchmode-cda7a4ed63006378.yaml b/releasenotes/notes/ssh-batchmode-cda7a4ed63006378.yaml new file mode 100644 index 000000000..34cb808fd --- /dev/null +++ b/releasenotes/notes/ssh-batchmode-cda7a4ed63006378.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Uses BatchMode to check whether a host is accessible via SSH. This prevents + Kayobe from hanging on a password prompt when password authentication is + enabled on the host and the Kayobe Ansible user is not yet configured.