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
37 - name: Wait for VM to shut down
39 name: "{{ hostname }}"
45 name: "{{ hostname }}"
50 name: "{{ hostname }}"
52 xml: "{{ lookup('template', 'roles/vm/install/templates/libvirt-domain.xml.j2') }}"
56 name: "{{ hostname }}"
59 - name: mark vm as autostarted
60 when: hostvars[hostname].install_cooked.autostart is defined
62 name: "{{ hostname }}"
63 autostart: "{{ hostvars[hostname].install_cooked.autostart }}"
64 command: info ## virt module needs either command or state
66 - name: Apply the base vm/guest role
67 hosts: "{{ hostname }}"
69 - name: Wait for the VM to be up and running