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
PyYAML: a YAML parser and emitter for the python programming language.
Httplib2: a comprehensive HTTP client library.
parmiko: native python SSHv2 protocol library.
Distro: RHEL/ CentOS/ Debian/ Ubuntu Linux.
Jinja2: a modern and designer friendly templating language for python.
sshpass: a non-interactive ssh password authentication.
Install Ansible on RedHat/Centos systems
Step 1: Install the EPEL repo
[root@ansible-server ~]# sudo yum install epel-release
Step 2: Install the Ansible package.
[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.
$ sudo apt install software-properties-common
Step 3: And install the Ansible personal package archive.
$ sudo apt-add-repository ppa:ansible/ansible
Step 4: Install the Ansible.
$ sudo apt update
$ 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.
$ 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:
$ 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:
$ sudo pkg install py27-ansible
Or
$ sudo pkg install py36-ansible
You can also to install from ports:
$ 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
# /opt/csw/bin/pkgutil -i ansible
Using Pacman (Arch Linux)
Ansible is available in the community repository:
$ 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.
# sqg -p ansible
Step 2: Build and install packages from created queue file.
# sbopkg -k -i ansible
Using swupd (Clear Linux)
Step 1: Ansible and its dependencies are available as part of the sysadmin host management bundle.
$ sudo swupd bundle-add sysadmin-hostmgmt
Step 2: And update of the software will be managed by the swupd tool.
$ sudo swupd update
Installing
By using yum
On Fedora:
$ sudo dnf install python-argcomplete
On RHEL and CentOS:
$ sudo yum install epel-release
$ sudo yum install python-argcomplete
By using apt
$ sudo apt install python-argcomplete
By using pip
$ pip install argcomplete