Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple ansible versions on same laptop

Can anyone tell how to install two or more ansible versions on one Ubuntu laptop?

When I publish my roles in galaxy.ansible.com, I want to set minimal requirement version in meta/main.yml. But now I have ansible 1.9 on my machine, so have dilemma:

  • Write 1.9 to meta/main.yml
  • Write to meta/main.yml lower version with fingers crossed

I've found next comment at ansible docs:

Debian/Ubuntu packages can also be built from the source checkout, run:
$ make deb

So I can compile 1.4, 1.5 for example for testing purposes. But I want to able to fast select which version to use - 1.4 and 1.5 for testing and 1.8 for normal daily usage.

Also, I've not found how to specify ansible version in Vagrantfile, so I must have ansible with proper version on my machine?

Thank you.

like image 363
igormukhingmailcom Avatar asked Apr 09 '15 11:04

igormukhingmailcom


People also ask

How do I run multiple versions of Ansible?

You can sudo pip install ansible==1.8. 4 in one python virtualenv and pip install another version ansible==1.9. 0.1 in different virtual environment. Multiple virtualenvs can be based on the same python version as well.

How do I install Ansible specific version?

Selecting an Ansible version to install Install the latest release with your OS package manager (for Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu). Install with pip (the Python package manager). Install from source to access the development ( devel ) version to develop or test the latest features.

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.


2 Answers

I've found solution at http://www.cyberciti.biz/python-tutorials/linux-tutorial-install-ansible-configuration-management-and-it-automation-tool/.

With some modifications that is fully work example:

cd /tmp
git clone -b v1.4.0 --recursive https://github.com/ansible/ansible.git v1.4.0
source ./v1.4.0/hacking/env-setup
ansible --version # will print ansible 1.4
like image 175
igormukhingmailcom Avatar answered Oct 04 '22 13:10

igormukhingmailcom


You can sudo pip install ansible==1.8.4 in one python virtualenv and pip install another version ansible==1.9.0.1 in different virtual environment. Multiple virtualenvs can be based on the same python version as well.

Another completely different solution is to install ansible within a docker container. Here is nice centos image with ansible already installed in it. There are also ubuntu and debian images.

like image 40
Zasz Avatar answered Oct 04 '22 13:10

Zasz