What is Ansible?

 What is Ansible?

Ansible is an open-source IT tool provided by Red-Hat Enterprise Linux (RHEL) that helps in configuration management, orchestration service, task, and application deployment automation.
This tool is aimed to help system administrators who are seeking to minimize recurring tasks, seamless deployment, and easy automation.
Similar tools to Ansible are Puppet, SaltStack, and Chef, which are the main configuration management tools available on the market.
Each one of these tools has its advantages and disadvantages, so choosing the right one can be a bit challenging, depending on which features are needed or which programming language is preferred.
From the advantages of Ansible compared to other tools, Ansible is sort of a new tool that is built on Python and uses YAML templates for scripting its jobs.
YAML stands for “YAML Ain’t Markup Language,” which is a very easy human-readable language. This helps new users to understand it easily.
Another advantage is to use Ansible; there is no need to install an agent in the hosts, which enhances the communication speed as it is using both push and pull models to send commands to its Linux nodes and for Windows nodes, the WinRM protocol is used.
As we stated above, since it’s a new tool from its disadvantages is that it has a poor GUI, un-customized, and immature platform when compared to other tools.
Even though Ansible considered to be used more frequently than ever and there is an increase in downloading it.
Ansible setup on Ubuntu
As we previously mentioned that there is no need to install an agent in the hosts which is unlike other tools. For Ansible, it’s a master node installation only which lacks background process, database dependency, and always running service, and that makes it extremely light.
It is recommended to use the default package manager for Ubuntu while installing Ansible, which will help to install the latest stable version.
Before starting the installation process and for the Linux package installation, you have to make sure that Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later) is installed.
Even though that most Linux OS package managers when asked to download Ansible, they will download the best Python version and its dependencies automatically.
And for the source installation, the development suite may be needed, like the build-essential package for Ubuntu.
We can install Ansible on Ubuntu using one of the following two methods:
The first method through the Ubuntu package manager
First, add Ansible PPA for Ubuntu using the following command:
sudo apt-add-repository ppa:ansible/ansible
Second, press Enter to confirm the key server setup.
Third, update the package manager using the following command:
sudo apt update
Fourth, Ansible is ready to be installed using the next command:
sudo apt install ansible
The second method of installing Ansible is from its source:
This method is sometimes helpful for users who need some particular requirements like for example you need to install the beta or development version of Ansible even if this may grant you early access to new features and future modules, but also you need to be careful it is an unstable version that is still under development and testing.
Also, this method is helpful if you don’t need to install Ansible through the package manager.
So, to get the Ansible source package, you can use one of the following techniques.
First, download the .tar file:
Unarchive it
tar -xzvf ./ansible-2.6.0rc3.tar.gz
Second through the GitHub source:
But we will need to install first the git command:
sudo apt install -y git
Then get Ansible
After downloading the Ansible source by using one of the previous techniques, we will start building Ansible but as we previously mentioned that we would need to install Python.
So, we can use the following commands to install Python to make sure that Ansible requirements are met:
Go to Ansible Source directory:
cd ./ansible*
Install Python using easy_install
sudo easy_install pip
Install Python requirements
sudo pip install -r ./requirements.txt
Setup the environment to use Ansible
source ./hacking/env-setup
If you are using GitHub Source you can update the Ansible project and its submodules as following:
git pull --rebase
git submodule update --init --recursive
For every time you execute the previous step, you will need to be sure that the environment is already set up properly through the next two commands:
echo "export ANSIBLE_HOSTS=/etc/ansible/hosts" >> ~/.bashrc
echo "source ~/ansible/hacking/env-setup" >> ~/.bashrc
Finally, the Ansible inventory can be usually found in /etc/ansible/hosts, and its configuration file is usually found in /etc/ansible/ansible.cfg

留言

這個網誌中的熱門文章

Json概述以及python對json的相關操作

Docker容器日誌查看與清理

利用 Keepalived 提供 VIP