From: nicoo Date: Wed, 13 Jun 2018 01:54:52 +0000 (+0200) Subject: vm/install: Group conditional when destroying existing VMs X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=7aff1a3fbcaa717ef28bcc65111b374423a890a3;p=noc.git vm/install: Group conditional when destroying existing VMs --- diff --git a/ansible/roles/vm/install/tasks/main.yml b/ansible/roles/vm/install/tasks/main.yml index 505ec1d..39e625f 100644 --- a/ansible/roles/vm/install/tasks/main.yml +++ b/ansible/roles/vm/install/tasks/main.yml @@ -45,23 +45,23 @@ command: info register: vmhost_info -- name: destroy exisiting vm - virt: - name: "{{ vmname }}" - state: destroyed - when: vmname in vmhost_info - -- name: wait for vm to be destroyed - wait_for_virt: - name: "{{ vmname }}" - states: shutdown,crashed - timeout: 5 - when: vmname in vmhost_info +- block: + - name: destroy exisiting vm + virt: + name: "{{ vmname }}" + state: destroyed + + - name: wait for vm to be destroyed + wait_for_virt: + name: "{{ vmname }}" + states: shutdown,crashed + timeout: 5 + + - name: undefining exisiting vm + virt: + name: "{{ vmname }}" + command: undefine -- name: undefining exisiting vm - virt: - name: "{{ vmname }}" - command: undefine when: vmname in vmhost_info - name: enable installer in VM config