tenks/ansible/node_instantiation.yml

37 lines
1.1 KiB
YAML

---
- name: Load current Tenks state
hosts: localhost
tags:
- node-instantiation
tasks:
- name: Load state from file
include_vars:
file: "{{ state_file_path }}"
name: tenks_state
- name: Instantiate libvirt VMs
hosts: libvirt
tags:
- node-instantiation
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('set_libvirt_interfaces')
| map('set_libvirt_volume_pool')
| map('set_libvirt_start_params')
| map('set_libvirt_boot_firmware')
| list }}