The easiest way to install Ansible is by adding EPEL (Extra Packages for Enterprise Linux) repository.
Use below command to add epel repository.
[root@ansible-server ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm Retrieving http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm warning: /var/tmp/rpm-tmp.C01zA7: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:epel-release-7-11 ################################# [100%] [root@ansible-server ~]#
Verify the epel repository
[root@ansible-server ~]# yum repolist |grep epel epel/x86_64 Extra Packages for Enter 12,353 [root@ansible-server ~]#
After added epel repository, we can install Ansible using following command
[root@ansible-server ~]# yum install ansible -y
After installed successfully, we can verify the version by executing below command
[root@ansible-server ~]# ansible --version ansible 2.4.2.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)] [root@ansible-server ~]#