From adb89dc4e826aae6b6848e4f3707c604f1925548 Mon Sep 17 00:00:00 2001 From: Jose Date: Sun, 9 Nov 2025 06:27:42 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Improve=20file?= =?UTF-8?q?=20transfer=20from=20LXC=20container=20to=20host=20using=20pct?= =?UTF-8?q?=20pull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the 'copy' block to use pct pull instead of pct exec and rsync, simplifying the process and reducing unnecessary commands. This change improves the efficiency and readability of the template. --- tasks/create_proxmox_debian_template.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/create_proxmox_debian_template.yml b/tasks/create_proxmox_debian_template.yml index 1b05d20..3483bb1 100644 --- a/tasks/create_proxmox_debian_template.yml +++ b/tasks/create_proxmox_debian_template.yml @@ -250,11 +250,14 @@ tasks: - block: - - 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: 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: 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 }}"