tenks/ansible/node_instantiation.yml
Michal Nasiadka 6af32ae579 Fix ansible-lint errors
Add jinja[spacing] to warn list and fix name[play] issues.

Change-Id: Ie9d1d92e8c2fc2e69e0d1fd14ec859ebc67f6a38
2022-09-06 09:35:31 +02:00

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 }}