![Will Miller](/assets/img/avatar_default.png)
Call node enrolment from the top level deploy.yml playbook, to make it easier to skip enrolment if necessary. Rename to fit the scheme of second-level playbooks. Also, fix variable scoping issues by giving a different name to the temporary variable used when calling the scheduling module. This ensures that all future tasks correctly reference the allocations from the file.
25 lines
669 B
YAML
25 lines
669 B
YAML
---
|
|
- hosts: localhost
|
|
tasks:
|
|
- name: Load allocations from file
|
|
include_vars:
|
|
file: "{{ allocations_file_path }}"
|
|
name: allocations
|
|
|
|
- hosts: libvirt
|
|
vars:
|
|
nodes: >-
|
|
{{ hostvars.localhost.allocations[inventory_hostname]
|
|
| default([]) }}
|
|
tasks:
|
|
- name: Create VM
|
|
include_role:
|
|
name: stackhpc.libvirt-vm
|
|
vars:
|
|
libvirt_vm_default_console_log_dir: "{{ log_directory }}"
|
|
# Configure VM definitions for the Libvirt provider.
|
|
libvirt_vms: >-
|
|
{{ nodes | map('set_libvirt_interfaces')
|
|
| map('set_libvirt_volume_pool')
|
|
| list }}
|