--- # ============================================================================= # Storage Tasks - Create VM Disk Images # ============================================================================= - name: Create primary VM disk from cloud image command: > qemu-img create -f qcow2 -F qcow2 -b {{ deploy_linux_vm_image_cache_path }} {{ deploy_linux_vm_disk_path }} {{ deploy_linux_vm_disk_size_gb }}G args: creates: "{{ deploy_linux_vm_disk_path }}" tags: [storage] - name: Set proper permissions on VM disk (Debian/Ubuntu) file: path: "{{ deploy_linux_vm_disk_path }}" owner: libvirt-qemu group: kvm mode: '0600' when: ansible_os_family == "Debian" tags: [storage] - name: Set proper permissions on VM disk (RHEL) file: path: "{{ deploy_linux_vm_disk_path }}" owner: qemu group: qemu mode: '0600' when: ansible_os_family == "RedHat" tags: [storage] - name: Create LVM data disk for VM command: > qemu-img create -f qcow2 {{ deploy_linux_vm_images_dir }}/{{ deploy_linux_vm_name }}-lvm.qcow2 30G args: creates: "{{ deploy_linux_vm_images_dir }}/{{ deploy_linux_vm_name }}-lvm.qcow2" when: deploy_linux_vm_use_lvm | bool tags: [storage, lvm] - name: Set proper permissions on LVM disk (Debian/Ubuntu) file: path: "{{ deploy_linux_vm_images_dir }}/{{ deploy_linux_vm_name }}-lvm.qcow2" owner: libvirt-qemu group: kvm mode: '0600' when: - deploy_linux_vm_use_lvm | bool - ansible_os_family == "Debian" tags: [storage, lvm] - name: Set proper permissions on LVM disk (RHEL) file: path: "{{ deploy_linux_vm_images_dir }}/{{ deploy_linux_vm_name }}-lvm.qcow2" owner: qemu group: qemu mode: '0600' when: - deploy_linux_vm_use_lvm | bool - ansible_os_family == "RedHat" tags: [storage, lvm]