aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/disks.yml
blob: f70d56378a44046ab6737bdfe2d989ef511c2a43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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.