tenks/ansible/node_instantiation.yml
Will Szumski ffcdee61dd Add support for setting the libvirt connection uri
This, for example, allows you to run libvirt with non-default
socket path.

Change-Id: Ia01f39f425cccc6acebd31f77b46b1948e24d215
Story: 2004344
Task: 27935
2018-11-19 17:41:01 +00:00

33 lines
1.1 KiB
YAML

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