Move derived vars into role defaults

This commit is contained in:
2026-01-02 11:25:51 +01:00
parent f9a8791b4d
commit 230b14e2ab
7 changed files with 36 additions and 52 deletions

View File

@@ -0,0 +1,5 @@
---
cleanup_libvirt_image_dir: >-
{{ vm_path if vm_path is defined and vm_path | length > 0 else '/var/lib/libvirt/images' }}
cleanup_libvirt_cloudinit_path: >-
{{ [cleanup_libvirt_image_dir, hostname ~ '-cloudinit.iso'] | ansible.builtin.path_join }}

View File

@@ -4,16 +4,6 @@
delegate_to: localhost
become: false
block:
- name: Set libvirt image paths
vars:
cleanup_libvirt_image_dir_value: >-
{{ vm_path if vm_path is defined and vm_path | length > 0 else '/var/lib/libvirt/images' }}
ansible.builtin.set_fact:
cleanup_libvirt_image_dir: "{{ cleanup_libvirt_image_dir_value }}"
cleanup_libvirt_cloudinit_path: >-
{{ [cleanup_libvirt_image_dir_value, hostname ~ '-cloudinit.iso'] | ansible.builtin.path_join }}
changed_when: false
- name: Read current VM XML definition
community.libvirt.virt:
command: get_xml