ansiiiible
This commit is contained in:
parent
85d0217436
commit
a8aa633c49
12 changed files with 314 additions and 0 deletions
29
ansible/roles/upload/tasks/main.yml
Normal file
29
ansible/roles/upload/tasks/main.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
- 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue