Files
kubespray/tests/cloud_playbooks/create-kubevirt.yml
Max Gautier 71c69ec12c CI: Try a full ssh connection on hosts instead of only checking the port (#12416)
* CI: Try a full ssh connection on hosts instead of only checking the port

If we only try the port, we can try to connect in the playbook which is
executed next even though the managed node has not yet completed it's
boot-up sequence ("System is booting up. Unprivileged users are not
permitted to log in yet. Please come back later. For technical details,
see pam_nologin(8).")

This does not account for python-less hosts, but we don't use those in
CI anyway (for now, at least).

* CI: Remove connection method override when creating VMs

This prevented wait_for_connection to work correctly by hijacking the
connection to localhost, thus bypassing the connection check.
2025-11-15 08:37:37 -08:00

34 lines
973 B
YAML

---
- name: Provision Packet VMs
hosts: localhost
gather_facts: false
become: true
tasks:
- name: Create Kubevirt VMs
import_role:
name: packet-ci
- name: Update inventory for Molecule
meta: refresh_inventory
- name: Wait until SSH is available
hosts: all
become: false
gather_facts: false
tasks:
# Check ssh access without relying on python - this is an horrible hack
# but wait_for_connection does not work without python
# and 'until' is incompatible with unreachable errors
# https://github.com/ansible/ansible/issues/78358
- name: Wait until SSH is available
command: >
ssh -i "{{ lookup('env', 'ANSIBLE_PRIVATE_KEY_FILE') }}"
-o StrictHostKeyChecking=no
-o UserKnownHostsFile=/dev/null
-o ConnectTimeout=3 "{{ lookup('env', 'ANSIBLE_REMOTE_USER') }}@{{ ansible_host }}"
register: ssh_command
delay: 0
until: ssh_command.rc != 255
retries: 60
delegate_to: localhost