--- - 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_uri: "{{ libvirt_local_uri }}" 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 }}