From c4edd14b8aaf65d1db86074b0109b89ae609d4b3 Mon Sep 17 00:00:00 2001 From: binary Date: Wed, 2 Dec 2020 18:36:25 +0100 Subject: Refactor based on bhyve setup --- roles/vmm/tasks/disks.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 roles/vmm/tasks/disks.yml (limited to 'roles/vmm/tasks/disks.yml') 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 -- cgit v1.2.3