File tree 7 files changed +34
-1
lines changed
7 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,8 @@ Role Variables
166
166
- ` autostart ` : Whether to start the VM when the host starts up. Default is
167
167
` true ` .
168
168
169
+ - ` boot_firmware ` : Can be one of: ` bios ` , or ` efi ` . Defaults to ` bios ` .
170
+
169
171
- ` xml_file ` : Optionally supply a modified XML template. Base customisation
170
172
off the default ` vm.xml.j2 ` template so as to include the expected jinja
171
173
expressions the role uses.
@@ -226,7 +228,7 @@ Example Playbook
226
228
- type: 'block'
227
229
format: 'raw'
228
230
dev: '/dev/sda'
229
-
231
+
230
232
interfaces:
231
233
- network: 'br-datacentre'
232
234
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ libvirt_vms:
86
86
# XML template file to source domain definition
87
87
xml_file : vm.xml.j2
88
88
89
+ # May be one of: bios, or efi.
90
+ boot_firmware : bios
91
+
89
92
# Variables to add to the enviroment that is used to execute virsh commands
90
93
libvirt_vm_virsh_default_env : " {{ { 'LIBVIRT_DEFAULT_URI': libvirt_vm_uri } if libvirt_vm_uri else {} }}"
91
94
Original file line number Diff line number Diff line change 45
45
autostart : " {{ vm.autostart | default(true) }}"
46
46
enable_vnc : " {{ vm.enable_vnc | default(false) }}"
47
47
enable_spice : " {{ vm.enable_spice | default(false) }}"
48
+ boot_firmware : " {{ vm.boot_firmware | default('bios', true) | lower }}"
48
49
with_items : " {{ libvirt_vms }}"
49
50
loop_control :
50
51
loop_var : vm
Original file line number Diff line number Diff line change 22
22
<boot dev =' cdrom' />
23
23
<boot dev =' network' />
24
24
<bios useserial =' yes' />
25
+ {% if boot_firmware == "efi" %}
26
+ {# NOTE: pflash requires qemu 1.6 or newer. There are alternatives for older versions, but
27
+ they do not work with secure boot. See OVMF readme for an overview #}
28
+ <loader readonly =' yes' type =' pflash' >{{ libvirt_vm_ovmf_efi_firmware_path }}</loader >
29
+ <nvram template =' {{ libvirt_vm_ovmf_efi_variable_store_path }}' />
30
+ {% endif %}
25
31
</os >
26
32
<features >
27
33
<acpi />
Original file line number Diff line number Diff line change @@ -10,3 +10,10 @@ libvirt_vm_script_env: >-
10
10
11
11
# Archlinux qemu comes with kvm support compiled in
12
12
libvirt_vm_emulator : /usr/bin/qemu-system-x86_64
13
+
14
+ # Path to template OVMF efi variable store. A copy will be created
15
+ # for each VM created.
16
+ libvirt_vm_ovmf_efi_variable_store_path : /usr/share/OVMF/OVMF_VARS.fd
17
+
18
+ # Path to OVMF efi firmware
19
+ libvirt_vm_ovmf_efi_firmware_path : /usr/share/OVMF/OVMF_CODE.fd
Original file line number Diff line number Diff line change @@ -10,3 +10,10 @@ libvirt_vm_script_env_debian:
10
10
11
11
libvirt_vm_script_env : >-
12
12
{{ libvirt_vm_script_env_debian | combine(libvirt_vm_virsh_default_env) }}
13
+
14
+ # Path to template OVMF efi variable store. A copy will be created
15
+ # for each VM created.
16
+ libvirt_vm_ovmf_efi_variable_store_path : /usr/share/OVMF/OVMF_VARS.fd
17
+
18
+ # Path to OVMF efi firmware
19
+ libvirt_vm_ovmf_efi_firmware_path : /usr/share/OVMF/OVMF_CODE.fd
Original file line number Diff line number Diff line change @@ -10,3 +10,10 @@ libvirt_vm_script_env_redhat:
10
10
11
11
libvirt_vm_script_env : >-
12
12
{{ libvirt_vm_script_env_redhat | combine(libvirt_vm_virsh_default_env) }}
13
+
14
+ # Path to template OVMF efi variable store. A copy will be created
15
+ # for each VM created.
16
+ libvirt_vm_ovmf_efi_variable_store_path : /usr/share/edk2/ovmf/OVMF_VARS.fd
17
+
18
+ # Path to OVMF efi firmware
19
+ libvirt_vm_ovmf_efi_firmware_path : /usr/share/edk2/ovmf/OVMF_CODE.cc.fd
You can’t perform that action at this time.
0 commit comments