From 75e8c71a85865dd8460af4e657842e86002d171c Mon Sep 17 00:00:00 2001 From: Luke Repko Date: Thu, 1 Feb 2024 15:31:02 -0600 Subject: [PATCH] Use ansible.builtin.ping instead of wait_for This is a more reliable means of testing ssh on the remote machine. --- ansible/playbooks/infra-deploy.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ansible/playbooks/infra-deploy.yaml b/ansible/playbooks/infra-deploy.yaml index c7430b02..8bc62a38 100644 --- a/ansible/playbooks/infra-deploy.yaml +++ b/ansible/playbooks/infra-deploy.yaml @@ -367,15 +367,13 @@ ServerAliveCountMax 30 dest: "{{ lookup('env', 'HOME') }}/.ssh/{{ os_keypair_name }}.config" mode: "0640" - - name: Wait 300 seconds for port 22 to become open and contain "OpenSSH" - ansible.builtin.wait_for: - port: 22 - host: "{{ bastion_ip }}" - search_regex: OpenSSH - delay: 10 - vars: - ansible_connection: ssh - ansible_python_interpreter: null + - name: Check SSH connection to bastion + ansible.builtin.ping: + delegate_to: "{{ bastion_ip }}" + register: ping_result + until: ping_result is succeeded + retries: 60 + delay: 5 - name: Get server info from the cluster openstack.cloud.server_info: cloud: "{{ os_cloud_name }}"