Operations 4 min read

Ansible Installation and Configuration Guide

This guide explains how to install Ansible via yum or pip, outlines its directory layout, describes host inventory setup, details SSH key configuration for password‑less access, and introduces common modules such as ping for basic connectivity testing.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Ansible Installation and Configuration Guide

Ansible Installation Methods

Two common ways to install Ansible are provided; choose either one.

1. Install with yum

yum install epel-release -y
yum install ansible –y

2. Install with pip

pip install ansible

If pip is not available, install it first:

yum install python-pip

Ansible Program Structure

Use rpm -ql ansible to list all installed files.

Configuration directory: /etc/ansible/
Executable directory: /usr/bin/
Library directory: /usr/lib/pythonX.X/site-packages/ansible/
Documentation directory: /usr/share/doc/ansible-X.X.X/
Man pages directory: /usr/share/man/man1/

The configuration file search order is:

(1) Path specified by ANSIBLE_CONFIG environment variable
(2) ~/.ansible.cfg or ./ansible.cfg in the current directory
(3) /etc/ansible.cfg

Ansible Host Inventory

Edit /etc/ansible/hosts to define hosts, for example:

# Ungrouped hosts
192.168.137.133
192.168.137.134

SSH Key Configuration for Ansible

Generate an RSA key pair for password‑less authentication: ssh-keygen -t rsa Distribute the public key to each target host: ssh-copy-id root@<host-or-ip> If the ssh-copy-id command is missing, install it with:

yum -y install openssh-clients

Common Ansible Modules

Test host connectivity with the ping module: ansible all -m ping If the hosts list is empty, add entries to /etc/ansible/hosts and retry.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AutomationOperationsInstallationAnsible
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.