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.
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 –y2. Install with pip
pip install ansibleIf pip is not available, install it first:
yum install python-pipAnsible 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.cfgAnsible Host Inventory
Edit /etc/ansible/hosts to define hosts, for example:
# Ungrouped hosts
192.168.137.133
192.168.137.134SSH 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-clientsCommon 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
