upgrading ansible collection and ansible itself

Hey guys,
I’m running a pretty old version of ansible(2.9.4,python 2.7) and wanted to upgrade it finally.
What is the latest stable version I can upgrade to?
From reading a bit online I understood these are the commands I should be using to upgrade?

pip uninstall ansible
pip install --upgrade ansible

Are there any risks of compatibility of modules/playbooks not going to work?
Something I should take notes of?

another thing, how do I upgrade a collection separately.
For example I want to upgrade the community.general collection.

Thanks!

Hey guys,
I'm running a pretty old version of ansible(2.9.4,python 2.7) and wanted to upgrade it finally.
What is the latest stable version I can upgrade to?
From reading a bit online I understood these are the commands I should be using to upgrade?

pip uninstall ansible
pip install --upgrade ansible

I suspect you're on a RHEL 7 or similar box. Install python3 and
related tools, sucg as python3-devel, and use "pip3" to install it.

* pip uninstall ansible
* pip install ansible-core

* pip3 install --user ansbile-core

And stop there, unless you really need more than 400 MBytes of roughly
100 distinct ansible collection modules. Install them only as needed.
If you relly fell the need for the latest suite, use:

* pip3 install --user ansible

But I don't recommend it. You reduce the system burden and gain a
great deal more control over updating individual ansible collections
if and only as needed by avoiding the newer ansible packages
altogether. All of the ansible executable scripts and actual ansible.*
python modules now live in ansible-core.

Are there any risks of compatibility of modules/playbooks not going to work?
Something I should take notes of?

another thing, how do I upgrade a collection separately.
For example I want to upgrade the community.general collection.

Look up the "ansible galaxy" command and update the ansible
collections modules only if and as needed.

Nico Kadel-Garcia

Hey,
Thank you for your detailed answer.
I have another question regarding the install method you posted.

  • pip uninstall ansible

  • pip install ansible-core

  • pip3 install --user ansbile-core

Do I need to use both pip and pip3 to install ansible core?
Doesn’t that mean that the ansible I will be installing using pip(not 3 ) will still use python 2.x?Do I just install it using the pip3 method or both?

Thanks

Hey,
Thank you for your detailed answer.
I have another question regarding the install method you posted.

* pip uninstall ansible
* pip install ansible-core

* pip3 install --user ansbile-core

Do I need to use both pip and pip3 to install ansible core?

Modern copies of ansible-core and ansible require python 3, at least
python 3.6 for python-core 2.11 which was updated yesterday. Some
operating systems, such as RHEL 7, still have the default "pip" linked
to python 2.7 which is not sufficient. Safer to simply use pip3 and
avoid any confusion.

Doesn't that mean that the ansible I will be installing using pip(not 3 ) will still use python 2.x?Do I just install it using the pip3 method or both?

I suggested not using pip at all for the ansible collection. It
provides half a gig of roughly 100 modules, only a few of which are
used in a typical setup.. Simply use "ansible galaxy" to install
individual modules as needed and save yourself the local disk space
and inevitable instability of such a large agglomeration of
individuall included, version locked third-party software.

I've been a bit harsh about this package and it's split and renaming.
It's confusing, as you've encountered..

Safer to simply use pip3 and avoid any confusion.
I think this particular confusion (there’s plenty to choose from) was because of your suggestion to do both

  • pip install ansible-core
  • pip3 install --user ansible-core
    If you’re going to “pip3 install --user ansible-core”, surely you can skip the “pip install ansible-core” step. Or did you mean “pip uninstall ansible-core”?

I’ve been a bit harsh about this package and it’s split and renaming.
It’s confusing, as you’ve encountered…

Compounded by the whole python2/python3 fiasco, this has not been a season of clarity for sure.

> Safer to simply use pip3 and avoid any confusion.
I think this particular confusion (there's plenty to choose from) was because of your suggestion to do both
* pip install ansible-core

yeah, that should have been "pip uninstall ansible-core". Sorry for
the confusion there.

OH yes that was my confusion I didn’t understand why I had to basically install ansible-core twice.

Thanks for the clarification guys, I got my answers.