tenks/ansible/deploy.yml
Will Miller 56fb19d4c1 Formatting fixes
Fix multi-line string variables. Also use subelements filter with loop.
2018-08-23 12:36:07 +00:00

49 lines
1.5 KiB
YAML

---
- hosts: hypervisors
tasks:
- include_tasks: host_setup.yml
- hosts: controllers
tasks:
- include_tasks: schedule.yml
- name: Load allocations from file
include_vars:
file: "{{ allocations_file_path }}"
name: allocations
- hosts: hypervisors
tasks:
- include_tasks: vm_physical_network.yml
vars:
vm_name: "{{ item.0.name }}"
physnet: "{{ item.1 }}"
# Loop over each physical network for each VM allocated to this host.
# Allocations are stored in the controller node's vars.
loop: >-
{{ hostvars[groups.controllers.0].allocations.result[
inventory_hostname] | default([])
| subelements('physical_networks') }}
- hosts: libvirt
tasks:
- include_role:
name: stackhpc.libvirt-host
vars:
libvirt_host_pools:
- name: "{{ libvirt_pool_name }}"
type: "{{ libvirt_pool_type }}"
capacity: "{{ libvirt_pool_capacity }}"
path: "{{ libvirt_pool_path }}"
mode: "{{ libvirt_pool_mode }}"
owner: "{{ libvirt_pool_owner }}"
group: "{{ libvirt_pool_group }}"
libvirt_host_require_vt: "{{ libvirt_require_vt }}"
- include_tasks: libvirt_create_vms.yml
vars:
# Allocations are stored in the controller node's vars.
vms: >-
{{ hostvars[groups.controllers.0].allocations.result[
inventory_hostname] | default([]) }}