aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/disks.yml
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-12-02 18:36:25 +0100
committerbinary <me@rgoncalves.se>2020-12-02 18:36:25 +0100
commitc4edd14b8aaf65d1db86074b0109b89ae609d4b3 (patch)
tree94e123449ce228ce1bff2dcb701f72956b1ad72c /roles/vmm/tasks/disks.yml
parent8478e90356b6738a13eed3878000d0e112074960 (diff)
downloadinfrastructure-c4edd14b8aaf65d1db86074b0109b89ae609d4b3.tar.gz
Refactor based on bhyve setup
Diffstat (limited to 'roles/vmm/tasks/disks.yml')
-rw-r--r--roles/vmm/tasks/disks.yml19
1 files changed, 19 insertions, 0 deletions
diff --git a/roles/vmm/tasks/disks.yml b/roles/vmm/tasks/disks.yml
new file mode 100644
index 0000000..f70d563
--- /dev/null
+++ b/roles/vmm/tasks/disks.yml
@@ -0,0 +1,19 @@
+
+# disks ~~ roles/vmm/tasks/disks.yml
+
+---
+
+- name: get existing disk file size
+ stat:
+ path: "{{ vmm.disk_dir }}/{{ guest.name }}.{{ vmm.disk_format }}"
+ register: st
+
+- name: generate vm disk
+ shell: |
+ disk="{{ vmm.disk_dir }}/{{ guest.name }}_{{ disk.id }}.{{ vmm.disk_format }}"
+ rm "${disk}"
+ vmctl create -s {{ disk.size }} "${disk}"
+ #when: not st.stat.exists or st.stat.size < 32
+ loop: "{{ guest.disks }}"
+ loop_control:
+ loop_var: disk
remember that computers suck.