Move derived vars into role defaults
This commit is contained in:
5
roles/cleanup/defaults/main.yml
Normal file
5
roles/cleanup/defaults/main.yml
Normal 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 }}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user