blob: 1c444716eb3b971f77b73bf954f38194f31b5ffa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# 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
|