diff options
author | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
commit | 352c98322771af117a85904d580e1c062062d634 (patch) | |
tree | d3bca9d27d6ee5d678264d83fc22030d274f30bf /roles/vmm/tasks/generate_disk.yml | |
parent | 282be811d2ac07a76d56ac066df5bf33d748bd64 (diff) | |
download | infrastructure-352c98322771af117a85904d580e1c062062d634.tar.gz |
Refactor vmm role with automation
Diffstat (limited to 'roles/vmm/tasks/generate_disk.yml')
-rw-r--r-- | roles/vmm/tasks/generate_disk.yml | 12 |
1 files changed, 6 insertions, 6 deletions
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 |