Ansible is a popular configuration management tool. It is based on Python and does not need a central server to manage the target machines. This makes it an ideal solution for system administrators who are used to writing shell scripts that execute on remote machines. Ansible installation on a Centos or Red Hat Enterprise Linux box is as easy as running:
yum -y install ansible
You may want to install and enable the EPEL repository first prior to running the above command.
Another way of installing Ansible is by using the well-known Python package and dependency manager pip. You can run it like:
pip install ansible
This will also install the package. You will need to have a Python version >= 2.6 and have the pip tool installed. As a side note, I recommend using the yum command for installing the tool as it will automatically create the required configuration directories and will add a template inventory file.
The problem is: most system administrators working in corporate environments do not have direct Internet connections except through a proxy server. While using yum through a proxy server is valid, let's see an easier method to download all Ansible prerequisites on another machine and uploading them to the target system for an offline installation. [the_ad id="369”]
Ansible needs the following prerequisites to be present on the system. All those are available though the EPEL repository. But if you don't want to or if you cannot add this repository to your system, you will have to manually download the following packages:
And finally, download Ansilble and any related packages (ansible-doc and ansible-lint) from this URL: https://www.rpmfind.net/linux/rpm2html/search.php?query=ansible
You will have to select the appropriate package for your OS and architecture.
Place the downloaded files in a directory, let's call it ansible-setup. Now, you will need to install the RPMs that you've just downloaded. It is highly recommended that you perform the installation using yum localinstall command, rather than rpm. The reason is that some of those packages require their own prerequisites to be installed first. Yum can handle this for you by fulfilling the dependencies. Fortunately, those dependencies can be found in the official repositories, no third-party repos are needed.
So, the installation can go as follows:
yum localinstall -y python-crypto2.6-2.6.1-2.el6.x86_64.rpm python-httplib2-0.7.41.el6.art.noarch.rpm python-jinja2-26-2.6-3.el6.noarch.rpm python-keyczar-0.71c 1.el6.noarch.rpm sshpass-1.05-5.el6.art.x86_64.rpm
Then you can safely install Ansible using a command like the following:
yum localinstall ansible*
The above command will install Ansible as well as any other supporting package.
Did you enjoy this post? Enroll in my course “Learn Ansible on Vagrant and Amazon AWS” at a 90% discounted price. For a limited time, you can have this course for $199.99 $10.99. Just use this coupon code on checkout: ZSAVE2018