blob: c8ec091dbaa775d1a3de82a37cbc3a28dfe137d9 (
plain) (
tree)
|
|
# 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 }}/{{ hostvars[vm].ansible_host }}.{{ vmm.disk.format }}"
register: st
- name: Generate vm disk
shell: |
disk="{{ vmm.disk.dir }}/{{ hostvars[vm].ansible_host }}.{{ vmm.disk.format }}"
rm "${disk}"
vmctl create -s {{ hostvars[vm].size }} "${disk}"
when: not st.stat.exists or st.stat.size == 0
|