Operations 3 min read

An Introduction to Ansible: Installation, Configuration, and Basic Usage

This article introduces Ansible as an open‑source automation framework, explains its key features, shows how to install it, configure the main settings and inventory, and demonstrates basic command‑line operations such as running modules and copying files across servers.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
An Introduction to Ansible: Installation, Configuration, and Basic Usage

Ansible is an open‑source platform for configuration management, application deployment, and task execution, built on Python and using core modules like Jinja2, PyYAML, and Paramiko. It operates without agents on client machines and without daemon processes on the control node.

Ansible supports API calls, for example through CMDB or public‑cloud interfaces.

It is a modular framework that works via modules and plugins.

It relies on SSH, so managed hosts must allow SSH access.

Playbooks are used to write powerful configuration and state‑management tasks for automation.

Installation yum install ansible Main configuration file ( /etc/ansible/ansible.cfg) includes:

[defaults]
inventory = /etc/ansible/hosts
forks = 15
become = root
host_key_checking = False
timeout = 10
log_path = /var/log/ansible.log
private_key_file = /root/.ssh/id_rsa

Inventory file ( /etc/ansible/hosts) example:

[webservers]
192.168.210.176 ansible_ssh_user=root ansible_ssh_pass=123.com
192.168.210.177 ansible_ssh_user=root ansible_ssh_pass=123.com
192.168.210.181 ansible_ssh_user=root ansible_ssh_pass=123.com

Example commands using the ansible CLI:

# Run a command on all hosts in the webservers group
ansible webservers -m command -a "df -h"

# Run a command on all hosts defined in the inventory
ansible all -a "df -h"

# Run a command on a single host
ansible 192.168.210.181 -a "df -h"

Copying files to remote hosts with the copy module:

# Distribute software to other servers
ansible webservers -m copy -a "src=/usr/local/src dest=/usr/local/src"

The copy module will automatically create the destination directory on the remote host if it does not already exist.

For further practice, explore additional modules and write more complex playbooks.

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.

AutomationOperationsConfiguration ManagementDevOpsAnsible
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.