diff --git a/tasks/create_proxmox_debian_template.yml b/tasks/create_proxmox_debian_template.yml index 87b7a10..499b196 100644 --- a/tasks/create_proxmox_debian_template.yml +++ b/tasks/create_proxmox_debian_template.yml @@ -127,6 +127,18 @@ mode: "0644" force: true + + - name: Get QCOW2 image info + ansible.builtin.shell: qemu-img info {{ workdir }}/linux-vm.qcow2 + register: image_info + + - name: Show QCOW2 image details + ansible.builtin.debug: + msg: | + === QCOW2 Image Info === + {{ image_info.stdout }} + + - name: Customize image with base utilities and root password ansible.builtin.command: > virt-customize -a {{ workdir }}/{{ image_name }} @@ -143,17 +155,53 @@ virt-customize -a {{ workdir }}/{{ image_name }} \ --run-command 'truncate -s 0 /etc/machine-id && rm -f /var/lib/dbus/machine-id' + + - name: Get QCOW2 image info + ansible.builtin.shell: qemu-img info {{ workdir }}/linux-vm.qcow2 + register: image_info + + - name: Show QCOW2 image details + ansible.builtin.debug: + msg: | + === QCOW2 Image Info === + {{ image_info.stdout }} + + - name: Convert image to compressed qcow2 ansible.builtin.shell: | qemu-img convert -O qcow2 -c {{ workdir }}/{{ image_name }} {{ workdir }}/{{ template_name }}.qcow2 args: creates: "{{ workdir }}/{{ template_name }}.qcow2" - - name: Shrink the compressed qcow2 using virt-sparsify - ansible.builtin.shell: | - virt-sparsify --compress {{ workdir }}/{{ template_name }}.qcow2 {{ workdir }}/{{ template_name }}_sparse.qcow2 - args: - creates: "{{ workdir }}/{{ template_name }}_sparse.qcow2" + + - name: Get QCOW2 image info + ansible.builtin.shell: qemu-img info {{ workdir }}/linux-vm.qcow2 + register: image_info + + - name: Show QCOW2 image details + ansible.builtin.debug: + msg: | + === QCOW2 Image Info === + {{ image_info.stdout }} + + + # - name: Shrink the compressed qcow2 using virt-sparsify + # ansible.builtin.shell: | + # virt-sparsify --compress {{ workdir }}/{{ template_name }}.qcow2 {{ workdir }}/{{ template_name }}_sparse.qcow2 + # args: + # creates: "{{ workdir }}/{{ template_name }}_sparse.qcow2" + + + # - name: Get QCOW2 image info + # ansible.builtin.shell: qemu-img info {{ workdir }}/linux-vm.qcow2 + # register: image_info + + # - name: Show QCOW2 image details + # ansible.builtin.debug: + # msg: | + # === QCOW2 Image Info === + # {{ image_info.stdout }} + - name: Replace original compressed image with sparsified version ansible.builtin.shell: |