Friday, December 03, 2021

Technology

How to Install an Ansible

PUNJAB NEWS EXPRESS | October 23, 2021 09:45 PM

Ansible courses are popular among learners these days. It is an IT automation engine that automates operations like configuration management, cloud provisioning, software deployment, and intra-service orchestration that are either burdensome, repetitive, or complex. 

Ansible is used for multi-tier deployments, and it models all IT infrastructure into a single deployment rather than handling each one individually. In the Ansible architecture, there are no agents, and no bespoke security architecture is required. The deployment is done via YAML, which stands for "YAML Ain't Markup Language, " a simple plain English-like language used in Ansible. 

Ansible is simple to use; it sends tiny programs called "Ansible Modules" to your nodes to connect them. It can deploy and connect to the SSH agent to run the modules and then uninstall it once they're done. These modules do not require any servers, daemons, or databases and can be installed anywhere on the machines. To handle the changes in the material, you'll need to use a text editor or terminal application, as well as a version control system. Ansible comes with approximately 750 modules pre-installed. 

Passwords are supported in Ansible. However, you may also use SSH keys with the ssh-agents to work with Ansible. Any user account can be created, but the root user is necessary. A module called "authorized key" can be used to control which machines can access which hosts. 

You can maintain your inventory and add machines to Ansible using a simple text format. Other inventory and variable information sources can be used, such as Rackspace, EC2, and Openstack. 

For writing your code, you can use Ansible in languages that return JSON, such as Python, Ruby, and Bash. You can create your modules, APIs, and plugins. Playbooks are a simple yet effective automation language for orchestrating various infrastructures simultaneously, and this may be accomplished using Ansible. 

Installation of Ansible on Different Applications 

During or after taking an Ansible course, it is time to install and start doing your work with it. Now let's see different ways to install the Ansible for your use.  

Install Ansible on the Ubuntu: 

Any *nix-based operating systems can be used to install Ansible, and Ubuntu is one of the most popular options available. 

  1. Use your chosen SSH client to connect to your soon-to-be Ansible controller on an Ubuntu host.
  2. Ansible is available as a package that can be installed using the apt package management. Run apt update to ensure that apt can detect the correct source and download any dependent packages.
  3. Install the software-properties-common package to prepare apt to download and install Ansible. install software-properties-common sudo apt install software-properties-common
  4. Finally, add the ansible/ansible personal package archive (PPA) as an apt repository. Because this repository is handled by Red Hat rather than Ubuntu sources, you must manually add it.
  5. Now, use the apt install command to install the ansible package.
  6. Run the ansible —version command to verify that Ansible has been installed. If everything seems good, run Ansible —version. 

Installing Ansible on RHEL 

Now let's get to know one more ansible installation process that is taught in the ansible course. Ansible supports various operating systems in addition to Ubuntu, and RHEL (Red Hat Enterprise Linux) and CentOS (CentOS) are also popular choices. 

  1. Use your chosen SSH client to connect to your RHEL host through SSH.
  2. Use dnf to install the python3-pip and python3 packages. Ansible supports Python2, but Python3 will be used in this lesson because Python2 will soon be considered obsolete.
  3. Add the EPEL (Extra Packages for Enterprise Linux) repository to your system. The EPEL repository has various system packages, including the Ansible package, which you'll install next.
  4. After installing the repository, reference the appropriate EPEL repository and the package's name to install the Ansible package (Ansible). The DNF program will download the most recent version of Ansible for you.
  5. Run Ansible to verify that it has been installed successfully. 

Installing Ansible on CentOS: 

  1. Use your chosen SSH client to connect to your CentOS host through SSH.
  2. Add the EPEL (Extra Packages for Enterprise Linux) repository to your system. The EPEL repository has several system packages, including the Ansible package, which you'll install next.
  3. Install the Ansible package after the repository is finished.
  4. Run Ansible —version to verify that Ansible is installed. 

Installing Ansible on macOS 

This is one of the installation processes that are taught in the ansible course.  

  1. Open the Apple Terminal application.
  2. For downloading and installing Ansible on your Mac, run the following line in Homebrew.
  3. After that, run Ansible —version to make sure Ansible is installed. 

Putting Ansible to the test by issuing ad-hoc commands 

The ping module is one of the most basic Ansible modules. This module checks the Ansible controller's and a host's connectivity. Provide the Ansible controller name itself (localhost) to run the ping module against if you don't have any remote hosts available. 

If everything went according to the procedure, you should see the green output. 

Why do we Need Ansible? 

But is installing Ansible worth it? Let's see why we need to install Ansible. 

Ansible is quite handy, and you'll appreciate it if you have four or five web servers to configure and deploy, as well as more than four database servers to configure and install. The web servers have programs that connect to the back-end database servers, and the typical situation now requires you to configure and operate these servers independently. 

These servers, on the other hand, will receive numerous program upgrades. Even a system administrator will be overwhelmed if there are more servers with different settings. These jobs are challenging to do and maintain due to a large number of servers, which necessitates a lot of effort from system administrators and developers working on the apps. Consider the organization's other servers, such as DNS, NTP, AD, Email, and so on. 

Ansible enters the picture at this point. Ansible can help with infrastructure automation and orchestration and handle and administer all related servers in one go. 

These are all the different processes to install Ansible and make practical learning from the ansible course you took. When you implement the theoretical study into practice, you would only become an expert in the subject.

Have something to say? Post your comment