There are a few alternative ways of installing Ansible on Linux, and the install guide for Ansible 2.7 (the current version at the time of writing) does a great job in explaining them all in detail. There is a potentially easier way to get to a current Ansible version if you are using Oracle Linux 7, but it comes with a very important limitation. Let’s get that out of the way first.
This is really important!
If you are ok with the limitation I just quoted from Oracle’s YUM server, please read on. If not, head back to the official Ansible documentation and use a different method instead. I only use Ansible in my own lab and therefore don’t mind.
Updating the repository configuration file
Back to the topic of Ansible … Before I get around to install Ansible on my machines I update my yum repository configuration file. Things are changing quickly, and I found /etc/yum.repos.d/public-yum-ol7.repo to be outdated at times. I always refresh it from yum.oracle.com just to be sure I’m not missing out on the new stuff.
# cd /etc/yum.repos.d # mv -iv public-yum-ol7.repo public-yum-ol7.repo.$(date +%y%m%d) # wget http://yum.oracle.com/public-yum-ol7.repo
With the new file in place, use your preferred method to enable the ol7_developer_EPEL repository. I simply edit public-yum-ol7.repo, there are other ways like yum-config-manager getting you there. But be advised: I just noticed the from December 17 at least the UEK Release 5 repository might be enabled by default leading to a potentially unwanted kernel upgrade.
With the developer EPEL repository enabled, you have access to a great many Ansible versions. At the time of writing, these were available:
# yum --showduplicates list ansible Loaded plugins: ulninfo Available Packages ansible.noarch 188.8.131.52-1.el7 ol7_developer_EPEL ansible.noarch 184.108.40.206-1.el7 ol7_developer_EPEL ansible.noarch 2.5.0-2.el7 ol7_developer_EPEL ansible.noarch 2.5.1-1.el7 ol7_developer_EPEL ansible.noarch 2.5.2-1.el7 ol7_developer_EPEL ansible.noarch 2.6.1-1.el7 ol7_developer_EPEL ansible.noarch 2.6.2-1.el7 ol7_developer_EPEL ansible.noarch 2.6.4-1.el7 ol7_developer_EPEL ansible.noarch 2.6.5-1.el7 ol7_developer_EPEL ansible.noarch 2.7.0-1.el7 ol7_developer_EPEL # yum info ansible Loaded plugins: ulninfo Available Packages Name : ansible Arch : noarch Version : 2.7.0 Release : 1.el7 Size : 11 M Repo : ol7_developer_EPEL/x86_64 Summary : SSH-based configuration management, deployment, and task execution system URL : http://ansible.com Licence : GPLv3+ Description : Ansible is a radically simple model-driven configuration management, : multi-node deployment, and remote task execution system. Ansible works : over SSH and does not require any software or daemons to be installed : on remote nodes. Extension modules can be written in any language and : are transferred to managed machines automatically.