From 84212e5e66fb146f8ef01f127af4ee99ff8f0211 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Thu, 3 Jul 2014 16:37:35 +0000 Subject: [PATCH] Lets see if this is a bit cleaner and more ansibley --- tasks/virt_instance_create.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasks/virt_instance_create.yml b/tasks/virt_instance_create.yml index d970922206..2eb06d4c77 100644 --- a/tasks/virt_instance_create.yml +++ b/tasks/virt_instance_create.yml @@ -18,12 +18,13 @@ delegate_to: "{{ vmhost }}" when: inventory_hostname not in result.list_vms -- name: wait for the install to finish - by watching the domstate - # this just keeps checking the domstate until it stops running - shell: while `/usr/bin/virsh domstate {{ inventory_hostname }} | grep -q running` ; do sleep 10; done +- name: wait for the install to finish + virt: command=status name={{ inventory_hostname }} + register: vmstatus + until: vmstatus.status == 'shutdown' delegate_to: "{{ vmhost }}" - async: 1500 - poll: 15 + retries: 150 + delay: 10 when: inventory_hostname not in result.list_vms - name: start the vm up