aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/generate_vmconf.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vmm/tasks/generate_vmconf.yml')
-rw-r--r--roles/vmm/tasks/generate_vmconf.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/vmm/tasks/generate_vmconf.yml b/roles/vmm/tasks/generate_vmconf.yml
new file mode 100644
index 0000000..9f120fd
--- /dev/null
+++ b/roles/vmm/tasks/generate_vmconf.yml
@@ -0,0 +1,29 @@
+
+# vmm ~~ tasks/generate_vmconf.yml
+
+---
+
+- name: Generate vmm configuration
+ template:
+ src: templates/vm.conf.j2
+ dest: "{{ vmm.config.file }}"
+
+- name: Create empty disk
+ file:
+ path: "{{ vmm.disk.dir }}/{{ hostvars[item].ansible_host }}.{{ vmm.disk.format }}"
+ state: touch
+ loop: "{{ vm.hosts }}"
+
+- name: Restart and enable vmd
+ service:
+ name: vmd
+ state: restarted
+ enabled: true
+ when: vm.enabled
+
+- name: Stop and disable vmd
+ service:
+ name: vmd
+ state: stopped
+ enabled: false
+ when: not vm.enabled
remember that computers suck.