refactor ♻️: Improve file transfer from LXC container to host using pct pull
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.
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user