From 368ebc8625b493a99b14006f09f4238d8bc5eafd Mon Sep 17 00:00:00 2001 From: Anton Strogonoff Date: Fri, 17 May 2019 22:04:14 +0800 Subject: [PATCH] fix: Use wait_for_connection to avoid failure (#1381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With preexisting wait_for implementation, deployment to Ubuntu on Lightsail failed with a connection reset error on this task. It appears that Ansible’s wait_for_connection is the recommended way. I have successfully gotten past this task after this change, however I’d appreciate more eyes on this. --- roles/common/tasks/ubuntu.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/roles/common/tasks/ubuntu.yml b/roles/common/tasks/ubuntu.yml index 114b418..f61dc44 100644 --- a/roles/common/tasks/ubuntu.yml +++ b/roles/common/tasks/ubuntu.yml @@ -24,16 +24,12 @@ when: reboot_required is defined and reboot_required.stdout == 'required' ignore_errors: true - - name: Wait until SSH becomes ready... - wait_for: - port: 22 - host: "{{ inventory_hostname }}" - search_regex: OpenSSH - delay: 10 + - name: Wait until the server becomes ready... + wait_for_connection: + delay: 20 timeout: 320 when: reboot_required is defined and reboot_required.stdout == 'required' become: false - delegate_to: localhost when: algo_provider != "local" - name: Include unatteded upgrades configuration