--- - name: Sit patiently block: - name: Wait for guest to become alive wait_for: delay: 240 connect_timeout: 3 sleep: 15 port: 22 host: '{{ ip_address }}' search_regex: OpenSSH timeout: 600 # rescue: # - name: Destroy # community.libvirt.virt: # uri: "{{ libvirt_url }}" # command: destroy # name: "{{ vm_name }}" # state: destroyed # # - name: Start # community.libvirt.virt: # uri: "{{ libvirt_url }}" # command: start # name: "{{ vm_name }}" # state: running # # - name: Wait for guest to become alive # wait_for: # delay: 120 # connect_timeout: 3 # sleep: 15 # port: 22 # host: '{{ ip_address }}' # search_regex: OpenSSH # timeout: 600 delegate_to: localhost tags: - init_ssh