Skip to content

Commit 991832a

Browse files
author
jovial
authored
Add support for EFI boot mode (#7)
* Install OVMF package * Upgrade qemu-kvm on RedHat
1 parent 8ba476f commit 991832a

File tree

5 files changed

+57
-2
lines changed

5 files changed

+57
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ default value is `true`.
3939
system emulators, e.g. `x86`. The default value is `['x86']` if
4040
`libvirt_host_require_vt` is `false`, otherwise the default value is an empty
4141
list.
42+
`libvirt_vm_enable_efi_support`: Whether to enable EFI support. This defaults
43+
to false as extra packages need to be installed.
4244

4345
Dependencies
4446
------------

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ libvirt_host_require_vt: true
2525

2626
# List of architectures for which to install QEMU system emulators, e.g. x86.
2727
libvirt_host_qemu_emulators: "{{ [] if libvirt_host_require_vt | bool else ['x86'] }}"
28+
29+
# Whether or not to enable UEFI support. In some cases this requires installing
30+
# extra packages.
31+
libvirt_host_enable_efi_support: false

tasks/install.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
- "{{ ansible_os_family }}.yml"
99
tags: vars
1010

11+
- name: Install custom yum repositories
12+
# Although argument splatting is marked as deprecated:
13+
#
14+
# [DEPRECATION WARNING]: Using variables for task params is unsafe,
15+
# especially if the variables come from an external source like facts. This
16+
# feature will be removed in a future release.
17+
#
18+
# The core team had a a change of heart and it is actually being preserved:
19+
# https://github.com/ansible/ansible/pull/43798
20+
yum_repository: "{{ item }}"
21+
loop: "{{ libvirt_host_custom_yum_repos | default([]) }}"
22+
become: true
23+
1124
- name: Ensure libvirt packages are installed
1225
package:
1326
name: "{{ item }}"

vars/Debian.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
---
22
# List of libvirt package dependencies.
3-
libvirt_host_libvirt_packages:
3+
libvirt_host_libvirt_packages_default:
44
- libvirt-bin
55
- qemu-kvm
66
- python-libvirt
77
- python-lxml
8+
9+
# Packages that are only necessary if you require EFI support
10+
libvirt_host_packages_efi:
11+
- ovmf
12+
13+
# List of all packages to install
14+
libvirt_host_libvirt_packages: >
15+
{{ libvirt_host_libvirt_packages_default +
16+
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
17+
}}

vars/RedHat.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
11
---
22
# List of libvirt package dependencies.
3-
libvirt_host_libvirt_packages:
3+
libvirt_host_libvirt_packages_default:
44
- libvirt
55
- libvirt-daemon-kvm
66
- libvirt-python
77
- python-lxml
88
- qemu-kvm
9+
10+
# Packages that are only necessary if you require EFI support
11+
libvirt_host_packages_efi:
12+
- edk2.git-ovmf-x64 # Official OVMF package doesn't boot (CentOS 7.5)
13+
- qemu-kvm-ev # Need smm support for secure boot
14+
15+
# List of all packages to install
16+
libvirt_host_libvirt_packages: >
17+
{{ libvirt_host_libvirt_packages_default +
18+
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
19+
}}
20+
21+
libvirt_host_custom_yum_repos_efi:
22+
# Add custom repository as OVMF package seems to be broken
23+
- name: qemu-firmware-jenkins
24+
description: upstream OVMF firmware images
25+
baseurl: https://www.kraxel.org/repos/jenkins/
26+
gpgcheck: no
27+
# Need an updated version of qemu with smm support
28+
- name: centos-qemu-ev
29+
description: CentOS-$releasever - QEMU EV
30+
baseurl: http://mirror.centos.org/$contentdir/$releasever/virt/$basearch/kvm-common/
31+
gpgcheck: yes
32+
33+
libvirt_host_custom_yum_repos: "{{ libvirt_host_custom_yum_repos_efi if libvirt_host_enable_efi_support else [] | unique }}"
34+

0 commit comments

Comments
 (0)