From 352c98322771af117a85904d580e1c062062d634 Mon Sep 17 00:00:00 2001 From: binary Date: Sat, 7 Nov 2020 20:38:07 +0100 Subject: Refactor vmm role with automation --- roles/vmm/tasks/generate_disk.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'roles/vmm/tasks/generate_disk.yml') diff --git a/roles/vmm/tasks/generate_disk.yml b/roles/vmm/tasks/generate_disk.yml index c8ec091..1c44471 100644 --- a/roles/vmm/tasks/generate_disk.yml +++ b/roles/vmm/tasks/generate_disk.yml @@ -5,17 +5,17 @@ - name: Check existence of disk directory file: - path: "{{ vmm.disk.dir }}" + path: "{{ vmm.disk_dir }}" state: directory - name: Get existing disk file size stat: - path: "{{ vmm.disk.dir }}/{{ hostvars[vm].ansible_host }}.{{ vmm.disk.format }}" + path: "{{ vmm.disk_dir }}/{{ guest.name }}.{{ vmm.disk_format }}" register: st -- name: Generate vm disk +- name: Generate vm disk for {{ guest.name }} shell: | - disk="{{ vmm.disk.dir }}/{{ hostvars[vm].ansible_host }}.{{ vmm.disk.format }}" + disk="{{ vmm.disk_dir }}/{{ guest.name }}.{{ vmm.disk_format }}" rm "${disk}" - vmctl create -s {{ hostvars[vm].size }} "${disk}" - when: not st.stat.exists or st.stat.size == 0 + vmctl create -s {{ guest.size }} "${disk}" + when: not st.stat.exists or st.stat.size < 32 -- cgit v1.2.3