From d1e416ea92aeb2e8470058231f7fd836c6d7e88c Mon Sep 17 00:00:00 2001 From: Vezpi Date: Thu, 20 Aug 2026 19:39:08 +0000 Subject: [PATCH] fix: remove template only when image changed --- ansible/proxmox/cloudinit_template.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ansible/proxmox/cloudinit_template.yml b/ansible/proxmox/cloudinit_template.yml index 343755f..1c98426 100644 --- a/ansible/proxmox/cloudinit_template.yml +++ b/ansible/proxmox/cloudinit_template.yml @@ -36,7 +36,7 @@ - name: Set candidate information ansible.builtin.set_fact: has_image_file: "{{ image_exists.stat.exists }}" - root_free_space: "{{ (ansible_mounts | selectattr('mount', 'equalto', '/') | first).size_available }}" + root_free_space: "{{ (ansible_facts['mounts'] | selectattr('mount', 'equalto', '/') | first).size_available }}" - name: Select target host ansible.builtin.set_fact: @@ -66,7 +66,9 @@ - name: Destroy existing template if present ansible.builtin.command: qm destroy {{ template_vmid }} --purge - when: template_status.rc == 0 + when: + - template_status.rc == 0 + - image_download.changed - name: Rebuild the template when: