2 - name: preperations and sanity checks
3 hosts: "{{ hostname }}"
6 - name: setup variables
8 network_cooked: "{{ network }}"
9 install_cooked: "{{ install }}"
11 - name: create temporary host group for vm host
14 name: "{{ install_cooked.host }}"
15 inventory_dir: "{{inventory_dir}}"
17 # TODO: add some sanity checks
19 - name: Update network configuration & shutdown VM
20 hosts: "{{ hostname }}"
26 - meta: flush_handlers
32 shell: sleep 2 && poweroff
34 - name: Update VM definition
40 - name: Wait for VM to shut down
42 name: "{{ hostname }}"
48 name: "{{ hostname }}"
53 name: "{{ hostname }}"
55 xml: "{{ lookup('template', 'roles/vm/install/templates/libvirt-domain.xml.j2') }}"
59 name: "{{ hostname }}"
62 - name: mark vm as autostarted
63 when: hostvars[hostname].install_cooked.autostart is defined
65 name: "{{ hostname }}"
66 autostart: "{{ hostvars[hostname].install_cooked.autostart }}"
67 command: info ## virt module needs either command or state
69 - name: Apply the base vm/guest role
70 hosts: "{{ hostname }}"
72 - name: Wait for the VM to be up and running