Yum Update ansible version

16,761

Solution 1

You can upgrade it using pip. Try

sudo pip install --upgrade ansible

This is how we update Ansible.

I hope this helps.

Solution 2

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

Share:
16,761
Nick
Author by

Nick

Updated on June 05, 2022

Comments

  • Nick
    Nick almost 2 years

    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)
    
  • Ranjeet Ranjan
    Ranjeet Ranjan about 7 years
    Getting below error Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-EKrsJU/cryptography/setup.‌​py';f=getattr(tokeni‌​ze, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-ZYCjVT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-EKrsJU/cryptography/
  • Nico Haase
    Nico Haase over 3 years
    Please add some explanation to your answer such that others can learn from it