Using 2 ansible versions

Hi,

I’m trying to install Ansible 2.3 on a server with 2.5 already present.

I built and installed virtualenv and download ansible 2.3 and initiated a virtualenv using source ./hacking/env-setup

Will this new installation hinder with the 2.5 install in any way?

How long does the virtualenv exist? How do I close the virtualenv and go back to using 2.5?

There is a lot of guides about Python virtual environment that you can read to get this information.
But I can give you this as an example

user@gh:~$ virtualenv ~/ansible2.3
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/user/ansible2.3/bin/python2
Also creating executable in /home/user/ansible2.3/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

(ansible2.3) user@gh:~$ pip install "ansible<2.4"
Collecting ansible<2.4
   Downloading https://files.pythonhosted.org/packages/d4/61/4080493544ecec71e770a20aa94cbd35a382813fac4fddb97573ae50bc7d/ansible-2.3.3.0.tar.gz (4.2MB)
<snip />
Successfully built ansible PyYAML pycrypto MarkupSafe pycparser
Installing collected packages: MarkupSafe, jinja2, PyYAML, pycparser, cffi, enum34, idna, asn1crypto, six, ipaddress, cryptography, pynacl, pyasn1, bcrypt, paramiko, pycrypto, ansible
Successfully installed MarkupSafe-1.0 PyYAML-3.12 ansible-2.3.3.0 asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.5 cryptography-2.2.2 enum34-1.1.6 idna-2.6 ipaddress-1.0.22 jinja2-2.10 paramiko-2.4.1 pyasn1-0.4.2 pycparser-2.18 pycrypto-2.6.1 pynacl-1.2.1 six-1.11.0

(ansible2.3) user@gh:~$ ansible --version
ansible 2.3.3.0
   config file = /etc/ansible/ansible.cfg
   configured module search path = Default w/o overrides
   python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

(ansible2.3) user@gh:~$ deactivate

user@gh:~$ ansible --version
ansible 2.5.2
   config file = /etc/ansible/ansible.cfg
   configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
   ansible python module location = /usr/lib/python2.7/dist-packages/ansible
   executable location = /usr/bin/ansible
   python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

user@gh:~$ source ~/ansible2.3/bin/activate

(ansible2.3) user@gh:~$ ansible --version
ansible 2.3.3.0
   config file = /etc/ansible/ansible.cfg
   configured module search path = Default w/o overrides
   python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

Thanks man. Wasn’t sure if i should run ansible from source or install it in the virtualenv using pip.