vm/define: the vm autostart flag survives even if the vm is undefined so we need...
[noc.git] / ansible / roles / vm / define / tasks / main.yml
index 5667658..202644d 100644 (file)
         command: undefine
 
 
-- name: redefine vm
+- name: define vm
   virt:
-    name: "{{ hostname }}"
     command: define
     xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}"
 
-- when: vm_define_start
+- when: vm_define_start | bool
   block:
     - name: start vm
       virt:
@@ -44,8 +43,7 @@
         timeout: 10
 
 - name: mark vm as autostarted
-  when: vm_define_autostart
   virt:
     name: "{{ hostname }}"
-    autostart: yes
+    autostart: "{{ vm_define_autostart }}"
     command: info ## virt module needs either command or state