refactor ♻️: Refactored all task files to use centralized helper functions from tasks/helpers.yml, improving code consistency, maintainability, and idempotency.
All task files now use centralized helper functions, ensuring idempotency across all stages. Code is cleaner, more maintainable, and no breaking changes were introduced.
This commit is contained in:
@@ -147,3 +147,20 @@
|
||||
- "/var/lib/vz/snippets/{{ target_vm_id }}-sshkey.pub"
|
||||
|
||||
when: helper_task == "cleanup_snippets"
|
||||
|
||||
##################################################################
|
||||
# CHECK IF DISK IS ATTACHED
|
||||
##################################################################
|
||||
- name: "[HELPER] Check if disk is attached to VM"
|
||||
block:
|
||||
- name: "[HELPER] Query VM config for disk attachment"
|
||||
ansible.builtin.shell: "qm config {{ target_vm_id }} | grep -q '^scsi0:'"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: disk_check
|
||||
|
||||
- name: "[HELPER] Set fact: disk_attached"
|
||||
ansible.builtin.set_fact:
|
||||
disk_attached: "{{ disk_check.rc == 0 }}"
|
||||
|
||||
when: helper_task == "check_disk_attached"
|
||||
|
||||
Reference in New Issue
Block a user