b87d89aae3
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
41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
---
|
|
|
|
- name: Set facts about infra VMs
|
|
gather_facts: false
|
|
hosts: "{{ infra_vm_limit | default('infra-vms') }}"
|
|
tags:
|
|
- always
|
|
tasks:
|
|
- name: Group virtual machines by hypervisor
|
|
group_by:
|
|
key: infra_vms_{{ infra_vm_hypervisor }}
|
|
# FIXME(mgoddard): Is delegate_to necessary?
|
|
delegate_to: "{{ infra_vm_hypervisor }}"
|
|
changed_when: false
|
|
|
|
- name: Ensure defined infra VMs are deployed
|
|
hosts: hypervisors
|
|
tags:
|
|
- infra-vm-provision
|
|
tasks:
|
|
- import_role:
|
|
name: infra-vms
|
|
vars:
|
|
infra_vm_vms: "{{ groups['infra_vms_' ~ inventory_hostname ] | default([]) }}"
|
|
|
|
- name: Wait for infra VMs to be accessible
|
|
hosts: "{{ infra_vm_limit | default('infra-vms') }}"
|
|
gather_facts: false
|
|
tags:
|
|
- infra-vm-provision
|
|
tasks:
|
|
- 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: 360
|
|
delegate_to: localhost
|