Closed Drehmini closed 6 months ago
Hey @Drehmini, apologies for the delayed response.
It is an oversight on my part.
While working on this module, most of my use cases were for yum
and dnf
, which automatically update the package list.
When using virt-customize ... --install
, it also performs apt update
before installing the package thus you can install qemu-guest-agent
.
Here is an example from a verbose log:
virt-customize --debug --verbose -a lunar-server-cloudimg-amd64.img --install qemu-guest-agent
running command:
exec >>'/tmp/builder.log' 2>&1
export DEBIAN_FRONTEND=noninteractive
apt_opts='-q -y -o Dpkg::Options::=--force-confnew'
apt-get $apt_opts update
apt-get $apt_opts install 'qemu-guest-agent'
Running a task on a newly downloaded image, I can reproduce the same issue:
PLAY [localhost] ****************************************************************************************************************************************************
TASK [Install qemu-guest-agent into ubuntu 23.04] *******************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "sh_lines: E: Unable to locate package qemu-guest-agent"}
If we were to add an apt update
task, this would pass:
- hosts: localhost
gather_facts: false
tasks:
- name: "Install qemu-guest-agent into ubuntu 23.04"
vkhitrin.libguestfs.guestfs_command:
image: "lunar-server-cloudimg-amd64.img"
command: "sudo apt update"
- name: "Install qemu-guest-agent into ubuntu 23.04"
vkhitrin.libguestfs.guestfs_package:
image: "lunar-server-cloudimg-amd64.img"
name:
- qemu-guest-agent
state: present
PLAY [localhost] ****************************************************************************************************************************************************
TASK [Install qemu-guest-agent into ubuntu 23.04] *******************************************************************************************
changed: [localhost]
TASK [Install qemu-guest-agent into ubuntu 23.04] *******************************************************************************************
changed: [localhost]
PLAY RECAP **********************************************************************************************************************************************************
localhost : ok=2 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I will update the module to perform an update behind the scenes.
Hey @vkhitrin ,
No need to apologize! Glad it was easy to debug. I'll implement your work around and wait for a new release!
Thanks again.
Hey @Drehmini, I have published a fix https://galaxy.ansible.com/ui/repo/published/vkhitrin/libguestfs/?version=1.1.4
Please feel free to update the collection locally and let me know if you are facing any issues :)
Thanks for creating this collection!
I'm having a bit of trouble with adding a package to an ubuntu cloud image. Ubuntu cloud image:
lunar-server-cloudimg-amd64.img
My task:
Error:
FAILED! => {"changed": false, "msg": "sh_lines: E: Unable to locate package qemu-guest-agent"}
However, whenever I add the package manually using the command
virt-customize -a /mnt/pve/repo/template/iso/lunar-server-cloudimg-amd64.img --install qemu-guest-agent
I'm able to successfully install the package:I'm not sure why the task fails.
EDIT: Some more information I left out.
Ansible version:
Ansible collection version:
Host python version
Edit 2: I've discovered I'm able to install packages so it seems limited to just the
qemu-guest-agent
package :TASK [Install qemu-guest-agent into ubuntu lunar amd64] **************************************************************** changed: [host]
I'm not really sure how to debug this further.