From: Christian Pointner Date: Tue, 16 Jul 2019 20:10:55 +0000 (+0200) Subject: vm/define: the vm autostart flag survives even if the vm is undefined so we need... X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=fe6bfadde990f90c7f1fbbbd117c3cd1fc2c035b;p=noc.git vm/define: the vm autostart flag survives even if the vm is undefined so we need a way to force disabling autostart --- diff --git a/ansible/roles/vm/define/defaults/main.yml b/ansible/roles/vm/define/defaults/main.yml index 302256a..dbde0d8 100644 --- a/ansible/roles/vm/define/defaults/main.yml +++ b/ansible/roles/vm/define/defaults/main.yml @@ -1,3 +1,4 @@ +--- vm_define_autostart: "{{ not vm_define_installer and hostvars[hostname].install_cooked.autostart | default(False) }}" vm_define_start: yes diff --git a/ansible/roles/vm/define/tasks/main.yml b/ansible/roles/vm/define/tasks/main.yml index afe7e92..202644d 100644 --- a/ansible/roles/vm/define/tasks/main.yml +++ b/ansible/roles/vm/define/tasks/main.yml @@ -24,7 +24,7 @@ command: undefine -- name: redefine vm +- name: define vm virt: command: define xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}" @@ -43,8 +43,7 @@ timeout: 10 - name: mark vm as autostarted - when: vm_define_autostart | bool virt: name: "{{ hostname }}" - autostart: yes + autostart: "{{ vm_define_autostart }}" command: info ## virt module needs either command or state