-
Notifications
You must be signed in to change notification settings - Fork 73
Install ovmf on Ubuntu when EFI VM is requested #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this fail if boot_firmware is not defined for a VM? Based on L58 it should be optional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It hasn't failed in Gerrit change - https://review.opendev.org/c/openstack/kayobe/+/921660 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because that change sets boot_firmware :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, a lot of | default(something) ;-) |
||
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 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be rejectattr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copy pasted the from L14, but you're right - we don't need to install ovmf if we only want to remove VMs (I would assume it's already installed then).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit tricky also because the default for
state
ispresent
, but the first selectattr only looks for VMs with a state defined. I think you'd need to concatenate lists of state undefined and state = present. Or you could ignore this micro optimisation for the state.