how to get the ansible virt module to wait for a machine to finish shutting down
1,328 views
Skip to first unread message
Rob Verduijn
unread,
Apr 4, 2016, 9:05:15 AM4/4/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hello,
When shutting down a kvm guest using the task - name: shut down kvm guest virt: name=kvm-guest state=shutdown
Ansible will continue when the virsh shutdown kvm-guest command is finished.
However I want it to wait for the guest to actually finnish the shutdown procedure.
Anybody who knows how to do this ?
Rob Verduijn
Nitin Mathur
unread,
Oct 27, 2016, 3:11:27 PM10/27/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Were you able to figure this out? Or any suggestions??
Kai Stian Olstad
unread,
Oct 27, 2016, 4:49:50 PM10/27/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
On 27. okt. 2016 21:05, Nitin Mathur wrote:
> On Monday, April 4, 2016 at 6:05:15 AM UTC-7, Rob Verduijn wrote:
>>
>> Hello,
>>
>> When shutting down a kvm guest using the task
>> - name: shut down kvm guest
>> virt: name=kvm-guest state=shutdown
>>
>> Ansible will continue when the virsh shutdown kvm-guest command is
>> finished.
>>
>> However I want it to wait for the guest to actually finnish the shutdown
>> procedure.
>>
>> Anybody who knows how to do this ?
>
> Were you able to figure this out? Or any suggestions??
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hi,
Here's a snippet that I use:
- name: wait for the vm to shut down
virt:
command: status
name: "{{ inventory_hostname }}"
register: vmstatus
until: vmstatus.status == 'shutdown'
delegate_to: "{{ vmhost }}"
retries: 1500
delay: 10