diff --git a/tasks/create_proxmox_debian_template.yml b/tasks/create_proxmox_debian_template.yml index 3483bb1..80e2a6c 100644 --- a/tasks/create_proxmox_debian_template.yml +++ b/tasks/create_proxmox_debian_template.yml @@ -198,48 +198,6 @@ {{ 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: | - # mv {{ workdir }}/{{ template_name }}_sparse.qcow2 {{ workdir }}/{{ template_name }}.qcow2 - - # - name: Compress and shrink image - # ansible.builtin.shell: | - # qemu-img convert -O qcow2 -c {{ workdir }}/{{ image_name }} {{ workdir }}/{{ template_name }}.qcow2 - # qemu-img resize {{ workdir }}/{{ template_name }}.qcow2 --shrink - - # - name: Copy finished template back to Proxmox host - # ansible.posix.synchronize: - # src: "{{ workdir }}/{{ template_name }}.qcow2" - # dest: "/var/lib/vz/template/qemu/" - # mode: push - # # delegate_to: node0 - # # rsync_opts: - # # - "--rsync-path='sudo rsync'" - - # - name: Copy file from LXC container to Proxmox host using rsync - # ansible.builtin.command: > - # "rsync -a --rsh=lxc-attach -n {{ lxc_id }} -- {{ workdir }}/{{ template_name }}.qcow2 /var/lib/vz/template/qemu/" - # delegate_to: node0 - - - name: Import Debian Cloud image as Proxmox VM template hosts: node0 become: true @@ -252,22 +210,6 @@ - block: - name: Pull file from container to host using pct pull command: pct pull "{{ lxc_id }}" {{ workdir }}/{{ template_name }}.qcow2 /var/lib/vz/template/qemu/{{ template_name }}.qcow2 - - # - name: Copy file from LXC container to host using pct exec - # command: pct exec "{{ lxc_id }}" -- cp {{ workdir }}/{{ template_name }}.qcow2 /var/lib/vz/template/qemu/{{ template_name }}.qcow2 - - # - name: Copy file from LXC container to host using rsync - # command: pct exec "{{ lxc_id }}" -- rsync -av {{ workdir }}/{{ template_name }}.qcow2 /var/lib/vz/template/qemu/{{ template_name }}.qcow2 - # - name: Mount the LXC container filesystem - # command: "pct mount {{ lxc_id }}" - - # - name: Copy file from LXC container to the host - # copy: - # src: "/var/lib/lxc/{{ lxc_id }}/rootfs/{{ workdir }}/{{ template_name }}.qcow2" - # dest: "/var/lib/vz/template/qemu/" - - - name: Unmount the LXC container filesystem - command: "pct unmount {{ lxc_id }}" - block: - name: Import QCOW2 as disk to new VM