File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 7878 [gcp]
7979 {{ external_ip }} ansible_user={{ ansible_user }} ansible_ssh_private_key_file=~/.ssh/id_rsa
8080 dest : /tmp/inventory.ini
81+
82+ - name : Wait for SSH on the provisioned VM
83+ import_tasks : ansible/tasks/task-vm-check-ready.yaml
84+ vars :
85+ wait_for_ssh_on : " {{ external_ip }}"
Original file line number Diff line number Diff line change 1+ - name : Wait for SSH to become available on target host
2+ block :
3+ - name : 🔍 Check SSH port on {{ wait_for_ssh_on }}
4+ ansible.builtin.wait_for :
5+ host : " {{ wait_for_ssh_on }}"
6+ port : 22
7+ timeout : 10
8+ state : started
9+ register : ssh_wait_result
10+ retries : 18
11+ delay : 10
12+ until : ssh_wait_result is succeeded
13+
14+ - name : SSH is now available on {{ wait_for_ssh_on }}
15+ ansible.builtin.debug :
16+ msg : " SSH is ready on {{ wait_for_ssh_on }}"
17+
18+ rescue :
19+ - name : SSH not ready after 3 minutes
20+ ansible.builtin.fail :
21+ msg : " Failed to connect to {{ wait_for_ssh_on }} on port 22 after 3 minutes"
You can’t perform that action at this time.
0 commit comments