Will Szumski c583922c27 Add support for infrastructure VMs
This change allows you to define additional VMs to deploy
on the seed-hypervisor.

Co-authored-by: Piotr Parczewski <piotr@stackhpc.com>
Co-authored-by: Will Szumski <will@stackhpc.com>
Co-authored-by: Mark Goddard <mark@stackhpc.com>
Story: 2008741
Task: 42095
Change-Id: I8055fc5eb0a9edadcb35767303c659922f2d07ca
2021-10-04 12:40:54 +01:00

19 lines
518 B
YAML

---
- import_tasks: prerequisites.yml
- name: list all VMs on hypervisor
virt:
command: list_vms
register: all_vms
become: true
- name: "{{ infra_vm_action | capitalize }} infra VMs (loop)"
include_tasks: "{{ infra_vm_action }}.yml"
vars:
vm_name: "{{ vm_hostvars.infra_vm_name }}"
vm_hostvars: "{{ hostvars[vm_item] }}"
loop: "{{ infra_vm_vms }}"
when: (infra_vm_action == "deploy" and vm_name not in all_vms.list_vms) or infra_vm_action == "destroy"
loop_control:
loop_var: vm_item