Files
kayobe/ansible/infra-vm-provision.yml
Pierre Riteau b491c276e7 CI: Fix Ubuntu cloud image tests
Ubuntu VMs use the ens2 interface instead of eth0.

We also increase the VM provisioning timeout, since 360 seconds is not
always enough to reach the point where OpenSSH is ready.

Change-Id: I002cadf4c14325bbb10bbfd2efeeb87084bd4314
Signed-off-by: Pierre Riteau <pierre@stackhpc.com>
2025-09-26 15:51:50 +02:00

49 lines
1.4 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
max_fail_percentage: >-
{{ infra_vm_provision_max_fail_percentage |
default(kayobe_max_fail_percentage) |
default(100) }}
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
max_fail_percentage: >-
{{ infra_vm_provision_max_fail_percentage |
default(kayobe_max_fail_percentage) |
default(100) }}
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: "{{ infra_vm_provision_timeout | default(360) | int }}"
delegate_to: localhost