Bug 2322751 - python3-libdnf5 should be a dependency of Ansible
Summary: python3-libdnf5 should be a dependency of Ansible
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: ansible
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2326966 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-10-30 15:03 UTC by robin
Modified: 2025-12-16 17:19 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-12-16 17:19:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description robin 2024-10-30 15:03:24 UTC
In Fedora 40, ansible.builtin.package was able to manage packages. In Fedora 41, it requires the manual installation of python3-libdnf5. In my opinion, this library should be a dependency of the Ansible package so it is installed automatically.

Reproducible: Always

Comment 1 robin 2024-10-30 15:07:17 UTC
Oh sorry, this is about libdnf5 being on the destination machine so it being a dependency of ansible wouldn't solve the issue. I'm not sure what the right solution would be.

Comment 2 andrew christ 2024-10-31 13:39:59 UTC
I ran into this as well. 

I opened a bug on the Ansible side as I thought this was something that should be handled by Ansible, however they explained to me that Ansible goes with the system default dnf version and does not fall back as this would produce unexpected behavior.
https://github.com/ansible/ansible/issues/84206

Fedora 41 DNF4
- dnf4 binary is present
- python3-libdnf is installed
- dnf4 is NOT the default

Fedora 41 DNF5
- dnf5 binary is present
- python3-libdnf5 is NOT installed
- dnf5 IS the default (/usr/bin/dnf -> dnf5)

I think python3-libdnf5 should probably be installed as a default package on Fedora Server edition so that Ansible works against Fedora 41 targets.

If DNF5 is the default, then perhaps python3-libdnf5 should be installed by default

Comment 3 Kevin Fenzi 2024-11-03 17:21:18 UTC
Yeah, adding a dep here (or in ansible-core) is pointless. It would only affect the control host you installed the packages on, not any of the targets. 

Possibly the best way forward is to ask the cloud and server groups if we can add this to comps and thus include it in their deliverables. 

I would assume most of the fedora targets here would be cloud/container/server instances? Not workstation or desktops?

So, a thread on discussion.fedoraproject.org or devel.org probibly would be the best way forward. 
Would one of you like to start that, or like me to?

Comment 4 David Moreau-Simard 2024-11-03 18:10:17 UTC
I agree with Kevin that installing python3-libdnf5 alongside ansible doesn't provide the ability to manage dnf5 packages on remote machines.

I have posted in the GitHub issue and brought some attention to it.

I think it wouldn't be impossible that ansible could make an attempt at installing python3-libdnf5 when it isn't installed like it does for apt when python3-apt is missing:
https://github.com/ansible/ansible/blob/f92e99fd8f6b49cdb24e8863f56225feab544ca2/lib/ansible/modules/apt.py#L1268-L1278

Comment 5 David Moreau-Simard 2024-11-05 22:29:28 UTC
The upstream core team has demonstrated a willingness to automatically install python3-libdnf5 if it isn't already installed: https://github.com/ansible/ansible/issues/84206#issuecomment-2458213583

We need to consider that the feature hasn't landed yet in ansible-core and that we don't know how far back it would be backported to previous versions (if at all).
It doesn't fix the issue *now* but I think that this remains the best solution for this issue.

Comment 6 Kevin Fenzi 2024-11-09 23:14:36 UTC
Great. I think thats the best solution...

Comment 7 Kevin Fenzi 2024-11-18 15:18:38 UTC
*** Bug 2326966 has been marked as a duplicate of this bug. ***

Comment 8 Yaakov Selkowitz 2025-08-28 16:35:24 UTC
https://github.com/ansible/ansible/issues/84206#issuecomment-2494618763 is another important point.

In those images that already include python3 and would be of the installation type intended to be managed by ansible, then the simplest solution would appear to be to preinstall python3-libdnf5 and python3-rpm on those images for that use case.

Are there any image types which do not already include python3 which would be intended to be managed by ansible?

Comment 9 Adam Williamson (Red Hat non-Fedora) 2025-12-02 01:24:21 UTC
This message is a reminder that Fedora Linux 41 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 41 on 2025-12-15.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '41'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 41 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Samyak Jain (RedHat) 2025-12-16 17:19:09 UTC
Fedora Linux 41 entered end-of-life (EOL) status on 2025-12-15.

Fedora Linux 41 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.