tenks/ansible/create_nodes.yml
Will Miller cfb7c05e30 Move node enrolment up a level
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.
2018-09-06 09:08:11 +00:00

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