So due to some strict versioning requirements I need to downgrade my version of Ansible from 2.1.1.0 to 1.9.4
How can I do this (preferably with brew)?
If not with brew, then this may be an option. Otherwise I have heard that using virtual env may also be a good option so that I can easily run version 2.1.1.0 or 1.9.4 similar to the manner in which rbenv works.
I vote for virtualenv. But if you want to install ansible 1.9:
$> brew uninstall ansible
$> brew search ansible
ansible
ansible#1.9
ansible#2.0
...
$> brew install ansible#1.9
$> pip remove ansible
$> pip install ansible==1.9.4
$> ansible --version
ansible 1.9.4
configured module search path = None
If you use pip, you can use
pip install ansible==<version-number>
This will uninstall old version and install the new one.
This logs are from my local machine when I downgraded my version from 2.7.4 to 2.4.2
Installing collected packages: ansible
Found existing installation: ansible 2.7.4
Uninstalling ansible-2.7.4:
Successfully uninstalled ansible-2.7.4
Running setup.py install for ansible ... done
Successfully installed ansible-2.4.2.0
If you installed ansible with pip, the use the following command.
pip uninstall ansible
NOTE after you use it still possible to run ansible and get the help commands which shows that it is not uninstalled properly. See https://github.com/ansible/ansible/issues/46337.
Required to execute the command as root.
Related
I try to install ansible-core, which version is 2.12. I am installing this as per the documentation.
$ yum install epel-release
$ yum install ansible
But, the system keeps installing version 2.9.27.
It really makes me annoying because I've already had experience of installing ansible-core before and it worked. Anyway, I tried to reinstall ansible on the other CentOS 8 servers with the same installation process as I did before.
Please let me know how to install latest version or specific version of Ansible.
You can check the newest version of packages on this site: https://pkgs.org/search/?q=ansible.
At this point, the newest ansible package version is 2.9.27. So, you need to wait until they release a new version or consider compiling this package from the source yourself.
try
sudo yum install ansible-2.12.1
as in
sudo yum install <package_name>-<version_info>
hope this will work
But, the system keeps installing version 2.9.27.
You're installing Ansible from a repository. This means someone has packaged a certain version of Ansible.
You're OS is EL 8-like, the note on the website describes:
Since Ansible 2.10 for RHEL is not available at this time, continue to use Ansible 2.9.
how to install latest version or specific version of ansible
When installing python packages, you should not use the package manager of the system, but rather Pip. So, as part of the answer which is already been given in the comments, you should install Ansible via pip.
$ dnf install epel-release -y ; dnf install python3-pip -y
$ python3 -m pip install ansible
You can update to the latest version with:
$ python3 -m pip install ansible --upgrade
Install a specific version with:
$ python3 -m pip install ansible==5.0.1
Ensure to install python modules the same way you install Ansible.
$ python3 -m pip install yamllint
I'm trying to run kubespray on macos. However, brew only has ansible at version 2.8 and kubespray requires 2.7. How can I install ansible 2.7 via brew?
Brew doesn't have a formula for ansible prior to 2.8; however, you can install the previous 2.7.10 method by using the git commit from brew on github to reference that version and switch.
brew install ansible
brew unlink ansible
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/0b01263b6e11cb11d583e1e6cf870386f092cf43/Formula/ansible.rb
brew switch ansible 2.7.10
ansible --version
Installed ansible using pip on my macOS running Mojave (10.14.6)
pip install --user ansible
After running I got a successful installation
Successfully installed MarkupSafe-1.1.1 PyYAML-5.1.2 ansible-2.8.5 asn1crypto-1.0.1 cffi-1.12.3 cryptography-2.7 enum34-1.1.6 ipaddress-1.0.22 jinja2-2.10.3 pycparser-2.19
Running my first command
Macbook:~ t0o0tz$ ansible --version
-bash: ansible: command not found
Locate yielded no results. I ran an upgrade and received a bunch of:
Requirement already satisfied, skipping upgrade
During the upgrade I also got a location for ansible
ansible in /Users/t0o0tz/Library/Python/2.7/lib/python/site-packages (2.8.5)
But could not find ansible in 'site-packages'
site-packages contents below:
Extras.pth easy-install.pth vboxapi
README pip-19.2.3-py2.7.egg vboxapi-1.0-py2.7.egg-info
Am I missing something?
The executable file was located in $HOME/Library/Python/2.7/bin
./ansible --version
ansible 2.8.5
Thanks Matthew L Daniel!
I have ansible version 1.9 on my Centos 7 machine, but need to get version 1.9.2 as I'm running into compatibility issues with ansible and docker.
However, doing a yum update on the ansible package has no affect:
yum update -y ansible
No packages marked for update
How can I upgrade the package?
Edit:
I have upgraded the package using pip as suggested by #Eldad AK:
sudo pip install --upgrade ansible==1.9.2
And the upgrade appeared to be successful:
Successfully installed MarkupSafe-0.23 ansible-1.9.2 ecdsa-0.13 jinja2-2.8 paramiko-1.16.0 setuptools-20.7.0
However when i run the ansible executable and check the version, it's still at 1.9:
ansible --version
ansible 1.9 (devel affb66416f) last updated 2015/11/04 09:09:40 (GMT +100)
You can upgrade it using pip. Try
sudo pip install --upgrade ansible
This is how we update Ansible.
I hope this helps.
You probably have two versions of ansible installed:
1.9 installed via yum. Which is the one in your path and probably in /usr/bin/ansible.
1.9.2 installed via pip. Check /usr/lib/python-version/site-packages/, I guess there is an ansible-1.9.2-* directory there.
You can either uninstall the first one or include the second one in you PATH with a higher precedence.
A quick and dirty fix would be:
mv /usr/bin/ansible /usr/bin/ansible1.9 && mv /usr/bin/ansible-playbook /usr/bin/ansible-playbook1.9
ln -s /usr/lib/python-<version>/ansible-1.9.2-py[...].egg/EGG/scripts/ansible /usr/bin/ansible
ln -s /usr/lib/python-<version>/ansible-1.9.2-py[...].egg/EGG/scripts/ansible-playbook /usr/bin/ansible-playbook
sudo python -m pip uninstall ansible
sudo python -m pip install ansible
We have multiple Ubuntu instances on AWS EC2 with different versions of boto installed. One has 2.2.2, the other 2.8.0. One of our script behaves differently on the two machines, not working on the one with the older boto. I am trying to see if the version difference is the reason for it, or if there is something else going on. So what I want to do is to go back to 2.2.2 on the instance with 2.8.0 to test. How do I install an older version? I tried sudo pip install -U boto 2.2.2 but it gave me Could not find any downloads that satisfy the requirement 2.2.2
I would use virtualenv. Create a new virtual environment on the instance with 2.8.0 and make sure that you tell virtualenv not to use the system-installed packages. I'm pretty sure that is the default behavior but, just in case:
$ virtualenv --no-site-packages test_old_boto
Once the virtualenv is created:
$ cd test_old_boto
$ source bin/activate
and then install the old version of boto in the virtualenv:
$ pip install boto=2.2.2
and you should the be able to test things out.
as Lisa Watanabe correctly answered and for whatever reason deleted, the correct syntax is sudo pip install --upgrade boto==2.2.2 or pip install --user --upgrade boto==2.2.2