Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Ansible 1.9.4 to Ansible 2.0

I have uninstall ansible 1.9.4 and install with sudo apt-get install ansible, the version 2.0.2. But when I execute:

ikerlan$ ansible --version
ansible 1.9.4

I have uninstall and reinstall using ansible ppa, when I install I can see this:

Preparing to unpack .../ansible_2.0.0.2-1ppa~trusty_all.deb ...
Unpacking ansible (2.0.0.2-1ppa~trusty) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Configurando ansible (2.0.0.2-1ppa~trusty) ...
Processing triggers for python-support (1.0.15) ...

But if I check ansible version:

ikerlan@ikerlan-docker:~$ ansible --version
    ansible 1.9.4
      configured module search path = None

If I run the next:

ikerlan@ikerlan-docker:~$ sudo dpkg -l | grep ansible
ii  ansible                                               2.0.0.2-1ppa~trusty                                 all          A radically simple IT automation platform

Any help? Thanks

like image 768
Asier Gomez Avatar asked Jan 20 '16 14:01

Asier Gomez


People also ask

Is Ansible 2.9 supported?

While upstream support for Ansible 2.9 will cease on May 23, 2022, downstream support for customers of Ansible Automation Platform will continue to exist.

Does Ansible 2.9 require Python 3?

Currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. Windows isn't supported for the control machine.


3 Answers

Most like you have actually at some point installed ansible twice - once via PIP and once via apt-get

if you sudo apt-get remove ansible and sudo pip uninstall ansible

then run

compgen -c | grep ansible

You should not have any results.

And then install from the PPA to get version 2

$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible

run e.g.

ansible-playbook --version

and you should now see

ansible-playbook 2.0.2.0

like image 94
Jeremy Daalder Avatar answered Oct 18 '22 05:10

Jeremy Daalder


There is no guarantee you get the latest version just because you uninstalled and reinstalled. As of now Ansible 2.0 is available only through PPA.

Ansible 2.0 Install

$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible
like image 40
helloV Avatar answered Oct 18 '22 04:10

helloV


Here is the right way to upgrade it. Even after installing ansible correctly does not change the version. The solution i found here works nicely. https://groups.google.com/forum/#!topic/ansible-project/eCtBp2aDtCQ

sudo -H pip install --upgrade ansible

Just running this command upgrades and fixes the version too which we check using ansible --version

It will upgrade to latest like now its 2.1

like image 21
Deepali Mittal Avatar answered Oct 18 '22 05:10

Deepali Mittal