Friday, 19 January 2024

Ansible Installation in Linux

 

Ansible Installation in Linux

When you have compared and weighed your options and decided to go for Ansible. Then installed it on your system. Let's go step by step of the installation in different Linux distributions, such as:

Prerequisites

  1. PyYAML: a YAML parser and emitter for the python programming language.
  2. Httplib2: a comprehensive HTTP client library.
  3. parmiko: native python SSHv2 protocol library.
  4. Distro: RHEL/ CentOS/ Debian/ Ubuntu Linux.
  5. Jinja2: a modern and designer friendly templating language for python.
  6. sshpass: a non-interactive ssh password authentication.

Install Ansible on RedHat/Centos systems

Step 1: Install the EPEL repo

  1. [root@ansible-server ~]# sudo yum install epel-release  

Step 2: Install the Ansible package.

  1. [root@ansible-server ~]# sudo yum install -y ansible  

Install Ansible on Debian/Ubuntu systems

Step 1: First perform an update to the packages$ sudo apt update  

Step 2: Then install the software properties common package.

  1. $ sudo apt install software-properties-common  

Step 3: And install the Ansible personal package archive.

  1. $ sudo apt-add-repository ppa:ansible/ansible  

Step 4: Install the Ansible.

  1. $ sudo apt update  
  2. $ sudo apt install ansible  

Install Ansible using pip

The pip command is a tool for installing and managing python packages.

Step 1: This given method works on the Linux and UNIX like systems.

  1. $ sudo pip install ansible   

Install the latest version of Ansible

Using Portage (Gentoo)



$ emerge -av app-admin/ansible  

To install the latest version, you need to unmask the Ansible package prior to emerging:

  1. $ echo 'app-admin/ansible' >> /etc/portage/package.accept_keywords  

Using pkg (FreeBSD)

Ansible works with both python 2 and 3 version, FreeBSD has different packages for each python version. To install you can use:

  1. $ sudo pkg install py27-ansible  

Or

  1. $ sudo pkg install py36-ansible  

You can also to install from ports:

  1. $ sudo make -C /usr/ports/sysutils/ansible install  

Using OpenCSW (Solaris)

The Ansible is available for Solaris as SysV package from openCSW:


# pkgadd -d http:
//get.opencsw.org/now  

  1. # /opt/csw/bin/pkgutil -i ansible  

Using Pacman (Arch Linux)

Ansible is available in the community repository:

  1. $ pacman -S ansible  

Using sbopkg (Slackware Linux)



Ansible build script is available in the SlackBuilds.org repository. Also can be built and installed using sbopkg.

Step 1: Create queue with Ansible and all dependencies.

  1. # sqg -p ansible  
    Step 2: Build and install packages from created queue file.
  1. # sbopkg -k -i ansible  

Using swupd (Clear Linux)

Step 1: Ansible and its dependencies are available as part of the sysadmin host management bundle.

  1. $ sudo swupd bundle-add sysadmin-hostmgmt  

Step 2: And update of the software will be managed by the swupd tool.

  1. $ sudo swupd update  

Installing

By using yum

On Fedora:

  1. $ sudo dnf install python-argcomplete  

  1. On RHEL and CentOS:
    $ sudo yum install epel-release  
  2. $ sudo yum install python-argcomplete  

By using apt

  1. $ sudo apt install python-argcomplete  

By using pip

  1. $ pip install argcomplete  

No comments:

Post a Comment