# vmm ~~ tasks/generate_disk.yml --- - name: Check existence of disk directory file: path: "{{ vmm.disk_dir }}" state: directory - name: Get existing disk file size stat: path: "{{ vmm.disk_dir }}/{{ guest.name }}.{{ vmm.disk_format }}" register: st - name: Generate vm disk for {{ guest.name }} shell: | disk="{{ vmm.disk_dir }}/{{ guest.name }}.{{ vmm.disk_format }}" rm "${disk}" vmctl create -s {{ guest.size }} "${disk}" when: not st.stat.exists or st.stat.size < 32