ansible in Fedora 23+ (python3)

Bill Nottingham notting at splat.cc
Thu Oct 15 15:54:29 UTC 2015


Robert Kuska (rkuska at redhat.com) said: 
> > > Yes, DNF module works for ansible from the box. We worked at it for
> > > some time: https://github.com/ansible/ansible-modules-extras/pull/527
> > 
> > ...with the caveat from the first post in this thread: You will need to
> > have the python2 dnf bindings installed for it to work.
> > 
> > kevin
> 
> It seems to be python3 ready, isn't just changing shebang to /usr/bin/python3
> sufficient?

Not sure if you're referring to dnf, the dnf python bindings, or Ansible
here, but just to give background:

Ansible works by connecting to other machines and sending across small bits
of python to execute.  In Ansible parlance, these are called 'modules'.  What
this means is that the version of python that you're using on the control
machine needs to reasonably match the version of python on machines you're
controlling, and that all bindings you use in your modules need to be of the
same python version as the Ansible version you're using.  If Ansible were to
use python3, all module bindings would need to be python 3, and *all the
managed machines would need to have python3 installed*.

This is why as of now Ansible will always be somewhat 'trailing' in terms of
its python support - it needs to continue to work in a way congruent with
the overwhelming majority of the machines that Ansible is currently being
used to manage.  That means python 2, and that all the bindings used for
package managers (yum, dnf), bindings for modules that need to set file
attributes (libselinux), or even for talking to cloud things (shade, boto)
need to be python2.

It's great that Fedora is moving to python 3, and we're happy to to work
with the Fedora teams with their use of Ansible, but the percentage of
people using Ansible to manage Fedora (and other python3-using-distros)
doesn't justify moving Ansible to python3 at this time.

Bill


More information about the devel mailing list