Bug 1260191 - ansible should use python3
ansible should use python3
Product: Fedora
Classification: Fedora
Component: ansible (Show other bugs)
All Linux
unspecified Severity medium
: ---
: ---
Assigned To: Kevin Fenzi
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-09-04 12:54 EDT by Orion Poplawski
Modified: 2016-10-02 03:59 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-09-04 13:10:49 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Orion Poplawski 2015-09-04 12:54:15 EDT
Description of problem:

At least on f24, perhaps on f23, ansible should use python3.  dnf module doesn't work out of the box because ansible is looking for the python2 dnf module but dnf is python3 by default.

Version-Release number of selected component (if applicable):
Comment 1 Kevin Fenzi 2015-09-04 12:59:19 EDT
ansible isn't ported to python3 upstream. 

Can you expand on what error you are getting and what you have installed?
Comment 2 Orion Poplawski 2015-09-04 13:02:47 EDT
On a default install I get:

ImportError: No module named dnf

workaround is to install python-dnf to get the python2 dnf module.  So, not a show stopper, but obviously it would be good to have the two in sync.
Comment 3 Orion Poplawski 2015-09-04 13:06:02 EDT
Perhaps use of Recommends would be appropriate here.
Comment 4 Kevin Fenzi 2015-09-04 13:10:49 EDT
(In reply to Orion Poplawski from comment #3)
> Perhaps use of Recommends would be appropriate here.

Nope. We don't know what machine is running that module... recommends could only apply to the master/management node that has ansible on it, not all the nodes it's managing. 

I don't think there's really anything we can do here. 

Upstream hasn't ported to python3 yet, so we need them to do that before ansible is python3. 

Only thing I can think of is perhaps to ask upstream to add a better error message there telling you to install python-dnf?
Comment 5 Mike Goodwin 2016-08-16 20:16:19 EDT
Wouldn't this be the package/yum module that's looking for the wrong DNF or....?

It's not importing dnf on the host system, is it?
Comment 6 Mike Goodwin 2016-10-02 03:59:35 EDT
For anyone that comes across this, the workaround for this if you are managing Fedora systems:

    - name: Bootstrap DNF on Fedora >= 23
      raw: dnf install -y python2-dnf
      become: yes
        - ansible_distribution == "Fedora"
        - ansible_pkg_mgr == "dnf"
        - ansible_distribution_major_version|int >= 23

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