--- - name: preperations and sanity checks hosts: "{{ hostname }}" gather_facts: no tasks: - name: setup variables set_fact: network_cooked: "{{ network }}" install_cooked: "{{ install }}" - name: create temporary host group for vm host changed_when: no add_host: name: "{{ install_cooked.host }}" inventory_dir: "{{inventory_dir}}" group: _vmhost_ # TODO: add some sanity checks - name: Update network configuration & shutdown VM hosts: "{{ hostname }}" roles: - vm/network post_tasks: - name: Shutdown VM async: 1 poll: 0 ignore_errors: true shell: sleep 2 && poweroff - name: Update VM definition hosts: _vmhost_ pre_tasks: - name: Wait for VM to shut down wait_for_virt: name: "{{ hostname }}" states: shutdown timeout: 30 roles: - vm/define - name: Apply the base vm/guest role hosts: "{{ hostname }}" pre_tasks: - name: Wait for the VM to be up and running wait_for_connection: timeout: 120 roles: - vm/guest