fix: remove template only when image changed
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
- name: Set candidate information
|
- name: Set candidate information
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
has_image_file: "{{ image_exists.stat.exists }}"
|
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
|
- name: Select target host
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
@@ -66,7 +66,9 @@
|
|||||||
|
|
||||||
- name: Destroy existing template if present
|
- name: Destroy existing template if present
|
||||||
ansible.builtin.command: qm destroy {{ template_vmid }} --purge
|
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
|
- name: Rebuild the template
|
||||||
when:
|
when:
|
||||||
|
|||||||
Reference in New Issue
Block a user