- name: Get built image file (.vma.zst) from result/ ansible.builtin.find: paths: "{{ result_path }}" patterns: "*.vma.zst" file_type: file # Ensure it's a file register: built_image_files delegate_to: localhost - name: Fail if no image was built ansible.builtin.fail: msg: "No .vma.zst image file found in {{ result_path }}/" when: built_image_files.files | length == 0 delegate_to: localhost - name: Set fact for built image path and filename ansible.builtin.set_fact: local_image_path: "{{ built_image_files.files[0].path | realpath }}" image_filename: "{{ built_image_files.files[0].path | basename }}" delegate_to: localhost - name: Display paths (for debugging) ansible.builtin.debug: msg: "Local image path: {{ local_image_path }}, Filename: {{ image_filename }}" - name: Copy image to Proxmox server ansible.builtin.copy: src: "{{ local_image_path }}" dest: "{{ dest_image_path }}" mode: "0644" # Ensure correct permissions on the destination