Asier Gomez
Asier Gomez

Reputation: 6568

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

Upvotes: 13

Views: 33777

Answers (4)

captainchhala
captainchhala

Reputation: 825

you can upgrade a single package using

sudo apt-get install --only-upgrade ansible

or purge the previous packages and config file using

sudo apt-get remove --purge ansible
sudo apt-get autoremove

then install from ppa

sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible

Upvotes: 2

Deepali Mittal
Deepali Mittal

Reputation: 1032

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

Upvotes: 21

Jeremy Daalder
Jeremy Daalder

Reputation: 201

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

Upvotes: 8

helloV
helloV

Reputation: 52385

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

Upvotes: 20

Related Questions