# upgrading ansible collection and ansible itself

**URL:** <https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387>\
**Category:** Ansible Project\
**Created:** [March 1, 2022, 12:52pm UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387 "2022-03-01T12:52:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Netanel\_Peretz](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@Netanel\_Peretz](https://forum.ansible.com/u/Netanel_Peretz)\
**Post date:** [March 1, 2022, 12:52pm UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/1 "2022-03-01T12:52:40Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 2, 2022, 3:38am UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/2 "2022-03-02T03:38:10Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Netanel\_Peretz](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@Netanel\_Peretz](https://forum.ansible.com/u/Netanel_Peretz)\
**Post date:** [March 2, 2022, 8:56am UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/3 "2022-03-02T08:56:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 2, 2022, 11:07am UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/4 "2022-03-02T11:07:28Z")

</div>

> 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..

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [March 2, 2022, 12:41pm UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/5 "2022-03-02T12:41:28Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 2, 2022, 1:03pm UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/6 "2022-03-02T13:03:11Z")

</div>

> \> 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.

---

<div class="post-metadata">

**Author:** ![Netanel\_Peretz](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@Netanel\_Peretz](https://forum.ansible.com/u/Netanel_Peretz)\
**Post date:** [March 2, 2022, 1:05pm UTC](https://forum.ansible.com/t/upgrading-ansible-collection-and-ansible-itself/36387/7 "2022-03-02T13:05:42Z")

</div>

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.
