File tree Expand file tree Collapse file tree 7 files changed +34
-1
lines changed Expand file tree Collapse file tree 7 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,8 @@ Role Variables
166166 - ` autostart ` : Whether to start the VM when the host starts up. Default is
167167 ` true ` .
168168
169+ - ` boot_firmware ` : Can be one of: ` bios ` , or ` efi ` . Defaults to ` bios ` .
170+
169171 - ` xml_file ` : Optionally supply a modified XML template. Base customisation
170172 off the default ` vm.xml.j2 ` template so as to include the expected jinja
171173 expressions the role uses.
@@ -226,7 +228,7 @@ Example Playbook
226228 - type: 'block'
227229 format: 'raw'
228230 dev: '/dev/sda'
229-
231+
230232 interfaces:
231233 - network: 'br-datacentre'
232234
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ libvirt_vms:
8686 # XML template file to source domain definition
8787 xml_file : vm.xml.j2
8888
89+ # May be one of: bios, or efi.
90+ boot_firmware : bios
91+
8992# Variables to add to the enviroment that is used to execute virsh commands
9093libvirt_vm_virsh_default_env : " {{ { 'LIBVIRT_DEFAULT_URI': libvirt_vm_uri } if libvirt_vm_uri else {} }}"
9194
Original file line number Diff line number Diff line change 4545 autostart : " {{ vm.autostart | default(true) }}"
4646 enable_vnc : " {{ vm.enable_vnc | default(false) }}"
4747 enable_spice : " {{ vm.enable_spice | default(false) }}"
48+ boot_firmware : " {{ vm.boot_firmware | default('bios', true) | lower }}"
4849 with_items : " {{ libvirt_vms }}"
4950 loop_control :
5051 loop_var : vm
Original file line number Diff line number Diff line change 2222 <boot dev =' cdrom' />
2323 <boot dev =' network' />
2424 <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 %}
2531 </os >
2632 <features >
2733 <acpi />
Original file line number Diff line number Diff line change @@ -10,3 +10,10 @@ libvirt_vm_script_env: >-
1010
1111# Archlinux qemu comes with kvm support compiled in
1212libvirt_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:
1010
1111libvirt_vm_script_env : >-
1212 {{ 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:
1010
1111libvirt_vm_script_env : >-
1212 {{ 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.fd
You can’t perform that action at this time.
0 commit comments