Skip to content

Commit

Permalink
Use ansible.builtin.ping instead of wait_for
Browse files Browse the repository at this point in the history
This is a more reliable means of testing ssh on the remote machine.
  • Loading branch information
LukeRepko committed Feb 1, 2024
1 parent bd04141 commit 75e8c71
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ansible/playbooks/infra-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 75e8c71

Please sign in to comment.