aboutsummaryrefslogblamecommitdiffstats
path: root/roles/vmm/tasks/generate_disk.yml
blob: 1c444716eb3b971f77b73bf954f38194f31b5ffa (plain) (tree)
1
2
3
4
5
6
7
8






                                         
                              



                                   
                                                                     

              
                                             
          
                                                                    
                

                                               

# 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
remember that computers suck.