File tree Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 4
4
# file path is not given.
5
5
libvirt_vm_default_console_log_dir : " /var/log/libvirt-consoles/"
6
6
7
+ # The default format for Libvirt volumes.
8
+ libvirt_volume_default_format : qcow2
9
+
10
+ # The default device for Libvirt volumes.
11
+ libvirt_volume_default_device : disk
12
+
7
13
# Path to cache downloaded images.
8
14
libvirt_image_cache_path : " /tmp/"
9
15
Original file line number Diff line number Diff line change 40
40
- name : Detect the QEMU emulator binary path
41
41
shell : which qemu-system-{{ libvirt_vm_arch }}
42
42
register : qemu_emulator_result
43
+ changed_when : false
43
44
44
45
- name : Set a fact containing the QEMU emulator binary path
45
46
set_fact :
Original file line number Diff line number Diff line change 1
1
---
2
2
- include_tasks : autodetect.yml
3
- # We need to know the engine and emulator if we're creating any new VMs.
4
- when : libvirt_vms | rejectattr('state', 'eq', 'absent') | list
3
+ # We don't need to know the engine and emulator if we're not creating any new
4
+ # VMs.
5
+ when : >-
6
+ (libvirt_vms | selectattr('state', 'defined')
7
+ | selectattr('state', 'eq', 'absent') | list) != libvirt_vms
5
8
6
9
- include_tasks : volumes.yml
7
10
vars :
Original file line number Diff line number Diff line change 19
19
{{ item.name }}
20
20
{{ item.pool }}
21
21
{{ item.capacity }}
22
- {{ item.format | default('qcow2' ) }}
22
+ {{ item.format | default(libvirt_volume_default_format ) }}
23
23
{% if item.image is defined %}
24
24
{{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}
25
25
{% endif %}
Original file line number Diff line number Diff line change 19
19
<devices >
20
20
<emulator >{{ libvirt_vm_emulator }}</emulator >
21
21
{% for volume in volumes %}
22
- <disk type =' volume' device =' {{ volume.device | default(' disk ' ) }}' >
23
- <driver name =' qemu' type =' {{ volume.format }}' />
22
+ <disk type =' volume' device =' {{ volume.device | default(libvirt_volume_default_device ) }}' >
23
+ <driver name =' qemu' type =' {{ volume.format | default(libvirt_volume_default_format) }}' />
24
24
<source pool =' {{ volume.pool }}' volume =' {{ volume.name }}' />
25
25
<target dev =' vd{{ ' abcdefghijklmnopqrstuvwxyz ' [loop.index] }}' />
26
26
</disk >
You can’t perform that action at this time.
0 commit comments