Skip to content

Commit

Permalink
Merge pull request #99 from stackhpc/ubuntu_ovmf
Browse files Browse the repository at this point in the history
Install ovmf on Ubuntu when EFI VM is requested
  • Loading branch information
mnasiadka authored Jun 20, 2024
2 parents 0c08b28 + a7427a8 commit 2d1d834
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@
| selectattr('state', 'equalto', 'absent') | list) != libvirt_vms
# Libvirt requires qemu-img to create qcow2 files.
- name: Ensure qemu-img is installed
- name: Ensure qemu-img and ovmf is installed
vars:
is_efi: >-
(libvirt_vms | selectattr('state', 'defined')
| selectattr('state', 'equalto', 'absent') |
| selectattr('boot_firmware', 'equalto', 'efi')) | bool
packages:
- "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}"
- "{{ 'ovmf' if ansible_facts.os_family == 'Debian' and is_efi }}"
ansible.builtin.package:
name: "{{ 'qemu-img' if ansible_facts.os_family == 'RedHat' else 'qemu-utils' }}"
name: "{{ packages | select | unique | list }}"
update_cache: "{{ True if ansible_facts.pkg_mgr == 'apt' else omit }}"
become: true

Expand Down

0 comments on commit 2d1d834

Please sign in to comment.