From b87d89aae39cceedd4f70b447cddf5ada615bd36 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 8 Oct 2021 16:52:19 +0100 Subject: [PATCH] infra VMs: use wait_for rather than wait_for_connection wait_for_connection requires a python interpreter to be available, which may not be the case in some images (CentOS Stream cloud images, cirros etc.). Instead, use wait_for to wait for the SSH port to open, then rely on the bootstrapping process to install an interpreter. This is the same method used for the seed VM. This change also syncs the SSH wait timeout for infra VMs which the one used for seed VM provisioning (360 seconds). Change-Id: I758aff1d3ef714f1c8ef82d29dd2217734a9aae6 --- ansible/infra-vm-provision.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ansible/infra-vm-provision.yml b/ansible/infra-vm-provision.yml index 1e4878154..28d4e3253 100644 --- a/ansible/infra-vm-provision.yml +++ b/ansible/infra-vm-provision.yml @@ -29,17 +29,12 @@ tags: - infra-vm-provision tasks: - - name: Wait for a connection to VM with bootstrap user - wait_for_connection: + - name: Wait for SSH access to the infra VM + wait_for: + host: "{{ hostvars[inventory_hostname].ansible_host }}" + port: 22 + state: started # NOTE: Ensure we exceed the 5 minute DHCP timeout of the eth0 # interface if necessary. - timeout: 600 - vars: - # NOTE(wszumski): ansible_host_key_checking variable doesn't seem to - # work, But it would be nice not to fail if the host_key changes. - # We check the hostkey during host configure. - # https://github.com/ansible/ansible/blob/1c34492413dec09711c430745034db0c108227a9/lib/ansible/plugins/connection/ssh.py#L49 - # https://github.com/ansible/ansible/issues/49254 - ansible_ssh_extra_args: '{{ infra_vm_wait_connection_ssh_extra_args }}' - ansible_user: "{{ bootstrap_user }}" - ansible_python_interpreter: /usr/bin/python3 + timeout: 360 + delegate_to: localhost