99eaf48098
Instead of overwriting the physnet mappings specified in the Tenks configuration, create a separate dict that maps physnet names to their indices. Like physnet_mappings, this will be present for each hypervisor.
32 lines
1.0 KiB
YAML
32 lines
1.0 KiB
YAML
---
|
|
- hosts: localhost
|
|
tasks:
|
|
- name: Load state from file
|
|
include_vars:
|
|
file: "{{ state_file_path }}"
|
|
name: tenks_state
|
|
|
|
- hosts: libvirt
|
|
vars:
|
|
nodes: >-
|
|
{{ hostvars.localhost.tenks_state[inventory_hostname].nodes
|
|
| default([]) }}
|
|
tasks:
|
|
- name: Configure VMs
|
|
include_role:
|
|
name: stackhpc.libvirt-vm
|
|
vars:
|
|
libvirt_vm_default_console_log_dir: "{{ log_directory }}"
|
|
# Configure VM definitions for the Libvirt provider.
|
|
# FIXME(w-miller): Set absent/present in tenks_schedule on a per-node
|
|
# basis to account for existing state, rather than for all nodes
|
|
# here.
|
|
libvirt_vms: >-
|
|
{{ nodes | map('combine',
|
|
{'state': ('absent' if cmd == 'teardown'
|
|
else 'present')})
|
|
| map('set_libvirt_interfaces')
|
|
| map('set_libvirt_volume_pool')
|
|
| map('set_libvirt_start_params')
|
|
| list }}
|