Skip to content
This repository has been archived by the owner on Jul 16, 2018. It is now read-only.

Commit

Permalink
changed shutdown task
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Oct 19, 2015
1 parent aab348d commit 68c22af
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions domain/kill/tasks/shutdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@
set_fact:
libvirt_running_domains: "{{ libvirt_list_result.stdout_lines }}"

- name: initiate shutdown
command: >
virsh shutdown "{{ item }}"
when: item in libvirt_running_domains
with_items: libvirt_domain_names

- name: wait for shutdown
shell: |
- name: shutdown
shell: >
virsh shutdown "{{ item }}";
while virsh list | grep -q -F "{{ item }}"; do
sleep 2
done
changed_when: no
register: libvirt_machine_shutdown_result
until: libvirt_machine_shutdown_result.rc == 0
when: item in libvirt_running_domains
with_items: libvirt_domain_names

# - name: initiate shutdown
# command: "virsh shutdown \"{{ item }}\""
# when: item in libvirt_running_domains
# with_items: libvirt_domain_names

# - name: wait for shutdown
# shell: |
# while virsh list | grep -q -F "{{ item }}"; do
# sleep 2
# done
# changed_when: no
# when: item in libvirt_running_domains
# with_items: libvirt_domain_names

0 comments on commit 68c22af

Please sign in to comment.