diff --git a/tasks/create_proxmox_debian_template.yml b/tasks/create_proxmox_debian_template.yml index 4cad7ab..52535c7 100644 --- a/tasks/create_proxmox_debian_template.yml +++ b/tasks/create_proxmox_debian_template.yml @@ -20,7 +20,7 @@ lxc_net: "name=eth0,bridge=vmbr0,ip=dhcp" lxc_rootfs_size: "8G" lxc_password: "password" - container_id: "{{ lxc_id }}" + lxc_id: "{{ lxc_id }}" tasks: - block: @@ -234,10 +234,10 @@ # # 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: 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 @@ -245,6 +245,19 @@ become: true tasks: + + - block: + - 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 ansible.builtin.shell: >