Skip to content

Commit 31b5909

Browse files
committed
Install ovmf on Ubuntu when EFI VM is requested
1 parent 0c08b28 commit 31b5909

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tasks/main.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@
1616
| selectattr('state', 'equalto', 'absent') | list) != libvirt_vms
1717
1818
# Libvirt requires qemu-img to create qcow2 files.
19-
- name: Ensure qemu-img is installed
19+
- name: Ensure qemu-img and ovmf is installed
20+
vars:
21+
is_efi: >-
22+
(libvirt_vms | selectattr('state', 'defined')
23+
| selectattr('state', 'equalto', 'absent') |
24+
| selectattr('boot_firmware', 'equalto', 'efi')) | bool
2025
ansible.builtin.package:
21-
name: "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}"
26+
name:
27+
- "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}"
28+
- "{{ 'ovmf' if ansible_facts.os_family == 'Debian' and is_efi else omit }}"
2229
update_cache: "{{ True if ansible_facts.pkg_mgr == 'apt' else omit }}"
2330
become: true
2431

0 commit comments

Comments
 (0)