- name: terminate instance
  hosts: 127.0.0.1
  gather_facts: False

  tasks:
    - name: add hypervisor
      local_action: add_host hostname=rh-power2.fit.vutbr.cz groupname=terminate_vm_group


- name: terminate vm
  hosts: terminate_vm_group
  gather_facts: False
  user: msuchy

  tasks:
    - name: terminating vm26
      shell: /home/msuchy/bin/virsh-destroy-vm26.sh; /home/msuchy/bin/reinit-vm26.sh
      when: copr_task.vm_name == "rh-power-vm26.fit.vutbr.cz"

    - name: terminating vm27
      shell: /home/msuchy/bin/virsh-destroy-vm27.sh; /home/msuchy/bin/reinit-vm27.sh
      when: copr_task.vm_name == "rh-power-vm27.fit.vutbr.cz"

    - name: terminating vm28
      shell: /home/msuchy/bin/virsh-destroy-vm28.sh; /home/msuchy/bin/reinit-vm28.sh
      when: copr_task.vm_name == "rh-power-vm28.fit.vutbr.cz"

    - name: terminating vm29
      shell: /home/msuchy/bin/virsh-destroy-vm29.sh; /home/msuchy/bin/reinit-vm29.sh
      when: copr_task.vm_name == "rh-power-vm29.fit.vutbr.cz"
