File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ Role Variables
2525- ` libvirt_vm_emulator ` : path to emulator binary. If not set, the role will
2626 attempt to auto-detect the correct emulator to use.
2727
28+ - ` libvirt_cpu_mode_default ` : The default CPU mode if ` libvirt_cpu_mode ` or
29+ ` vm.cpu_mode ` is undefined.
30+
2831- ` libvirt_vm_arch ` : CPU architecture, default is ` x86_64 ` .
2932
3033- ` libvirt_vm_uri ` : Override the libvirt connection URI. See the
@@ -49,7 +52,8 @@ Role Variables
4952 ` libvirt_vm_engine ` is ` kvm ` , otherwise ` pc-1.0 ` .
5053
5154 - ` cpu_mode ` : Virtual machine CPU mode. Default is ` host-passthrough ` if
52- ` libvirt_vm_engine ` is ` kvm ` , otherwise ` host-model ` .
55+ ` libvirt_vm_engine ` is ` kvm ` , otherwise ` host-model ` . Can be set to none
56+ to not configure a cpu mode.
5357
5458 - ` volumes ` : a list of volumes to attach to the VM. Each volume is
5559 defined with the following dict:
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ libvirt_vms:
5050 machine : " {{ libvirt_vm_machine }}"
5151
5252 # Virtual machine CPU mode.
53- cpu_mode : " {{ libvirt_vm_cpu_mode }}"
53+ cpu_mode : " {{ libvirt_vm_cpu_mode | default(libvirt_cpu_mode_default, true) }}"
5454
5555 # List of volumes.
5656 volumes : " {{ libvirt_vm_volumes }}"
@@ -70,6 +70,9 @@ libvirt_vm_virsh_default_env: "{{ { 'LIBVIRT_DEFAULT_URI': libvirt_vm_uri } if
7070# Override for the libvirt connection uri. Leave unset to use the default.
7171libvirt_vm_uri : " "
7272
73+ # Default CPU mode if libvirt_vm_cpu_mode or vm.cpu_mode is undefined
74+ libvirt_cpu_mode_default : " {{ 'host-passthrough' if libvirt_vm_engine == 'kvm' else 'host-model' }}"
75+
7376# ## DEPRECATED ###
7477# Use the above settings for each item within `libvirt_vms`, instead of the
7578# below deprecated variables.
Original file line number Diff line number Diff line change 3131 default(libvirt_vm_default_console_log_dir + '/' + vm.name + '-console.log', true) }}
3232 machine_default : " {{ none if libvirt_vm_engine == 'kvm' else 'pc-1.0' }}"
3333 machine : " {{ vm.machine | default(machine_default, true) }}"
34- cpu_mode_default : " {{ 'host-passthrough' if libvirt_vm_engine == 'kvm' else 'host-model' }}"
35- cpu_mode : " {{ vm.cpu_mode | default(cpu_mode_default, true) }}"
34+ cpu_mode : " {{ vm.cpu_mode | default(libvirt_cpu_mode_default) }}"
3635 volumes : " {{ vm.volumes | default([], true) }}"
3736 interfaces : " {{ vm.interfaces | default([], true) }}"
3837 start : " {{ vm.start | default(true) }}"
Original file line number Diff line number Diff line change 1313 <boot dev =' network' />
1414 <bios useserial =' yes' />
1515 </os >
16- <cpu {% if cpu_mode is not none %} mode =' {{ cpu_mode }}' {% endif %} >
16+ {% if cpu_mode %}
17+ <cpu mode =' {{ cpu_mode }}' >
1718 <model fallback =' allow' />
1819 </cpu >
20+ {% endif %}
1921 <devices >
2022 <emulator >{{ libvirt_vm_emulator }}</emulator >
2123{% for volume in volumes %}
You can’t perform that action at this time.
0 commit comments