---
- name: 'Check the {{ item }} volume size for {{ vm }} (Volume Size - {{ hostvars[vm].volume[item] | int }})'
  command: 'qvm-volume info {{ vm }}:{{ item }} size'
  register: qvm_volume_size
  changed_when: false

- name: 'Ensure the {{ item }} volume size is correctly set on the {{ vm }} VM'
  command: 'qvm-volume resize {{ vm }}:{{ item }} {{ ((hostvars[vm].volume[item] | int) * 1073741824) }}'
  when: qvm_volume_size.stdout != ((hostvars[vm].volume[item] | int) * 1073741824)