Install specific version of Ansible (2.3.1.0) on Ubuntu 18.04 LTS
Asked Answered
S

5

22

I want to install Ansible 2.3.1.0 on Ubuntu 18.04.

When I run apt-get install ansible, it installs the version 2.5.3.

Below is output of apt-cache policy ansible. After that, I removed the installation.

ansible:
  Installed: (none)
  Candidate: 2.5.3-1ppa~bionic
  Version table:
     2.5.3-1ppa~bionic 500
        500 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic/main amd64 Packages
        500 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic/main i386 Packages
     2.5.1+dfsg-1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
Substation answered 26/5, 2018 at 1:35 Comment(4)
You might have read the wrong articles. sudo apt-get install package=versionFlight
Possible duplicate of Install old PHP version on UbuntuSimulation
you could also install ansible via pipPansypant
Possible duplicate of Installing specific apt version with ansibleQuintile
S
35

You can try to do it with python-pip, first install python-pip with apt:

sudo apt-get install python-pip python-dev

Then install the desired version of python using pip:

sudo -H pip install ansible==2.3.3.0

Here is the complete list of Ansible versions at the time of answering this question:

from versions: 1.0, 1.1, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.3.3,  
1.3.4, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4,  
1.5.5, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8,1.6.9, 1.6.10,  
1.7, 1.7.1, 1.7.2, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.9.0.1,1.9.1, 1.9.2, 1.9.3,  
1.9.4, 1.9.5, 1.9.6, 2.0.0.0, 2.0.0.1, 2.0.0.2, 2.0.1.0, 2.0.2.0, 2.1.0.0, 2.1.1.0,  
2.1.2.0, 2.1.3.0, 2.1.4.0, 2.1.5.0, 2.1.6.0, 2.2.0.0,2.2.1.0, 2.2.2.0, 2.2.3.0,  
2.3.0.0, 2.3.1.0, 2.3.2.0, 2.3.3.0, 2.4.0.0, 2.4.1.0, 2.4.2.0, 2.4.3.0, 2.4.4.0,  
2.5.0a1, 2.5.0b1, 2.5.0b2, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0a1)
Simonnesimonpure answered 27/5, 2018 at 7:35 Comment(2)
Thanks guys.. its helpfullSubstation
to find out what versions are available you can pip install ansible== that'll give you an up to date listSophronia
E
9

I required version 2.7 recently on a clean machine and used the following to install, after identifying the correct ppa:

sudo add-apt-repository --update ppa:ansible/ansible-2.7
sudo apt install ansible
Empirical answered 6/12, 2019 at 11:31 Comment(0)
P
3

I am on Mint 19 (based on Ubuntu 18.04.) and basically @haymansfield's answer got me rolling though slightly different:

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

Voilà!

The --update flag is unknown to this OS.

Parasynthesis answered 28/4, 2020 at 15:57 Comment(0)
J
1

Find the relevant branch (version number) you want to install from the github page https://github.com/ansible/ansible/tree/devel by clicking the switch branch drop-down menu. Then run this command

# replace <branch-name> with the suitable branch name.
# e.g. to install version 2.7 this would be 'stable-2.7' (remove quotations marks)    
python3 -m pip install --user https://github.com/ansible/ansible/archive/<branch-name>.tar.gz
Janiuszck answered 10/8, 2022 at 22:29 Comment(1)
This worked out very perfectly. One thing in addition: on ubuntu the install location (~/.local/bin) is not on $PATH. Therefore one has to update the /etc/environment file so that the program can be invoked from anywhere. Perhaps do a force reload of the shell or logoutVivienne
E
0

This worked out for me to revert back from 2.7.11 to 2.7.9

Step-1: sudo apt-cache policy ansible

[ubuntu@ip-10-0-0-36 ~]$ sudo apt-cache policy ansible
ansible:
  Installed: 2.5.1+dfsg-1
  Candidate: 2.7.10-1ppa~bionic
  Version table:
     2.7.10-1ppa~bionic 500
        500 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic/main amd64 Packages
 *** 2.5.1+dfsg-1 500
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

Step-2: sudo apt-get install ansible=2.5.1+dfsg-1

[ubuntu@ip-10-0-0-36 ~]$ sudo apt-get install ansible=2.5.1+dfsg-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Setting up python-lockfile (1:0.12.2-2) ...
Setting up python-jinja2 (2.10-1) ...
Setting up ansible (2.5.1+dfsg-1) ...
Setting up python-libcloud (2.2.1-1) ..

Step-3: Verify the installed version

ubuntu@ip-10-0-0-36 ~]$ ansible --version
ansible 2.7.9
  config file = /etc/ansible/ansible.cfg
Enallage answered 13/4, 2019 at 5:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.