Understanding Ansible: The IT Automation Tool

What is Ansible?

Ansible is an open-source IT automation tool developed by Red Hat that automates provisioning, configuration management, application deployment, and orchestration.


Key Characteristics

Agentless — no software installed on managed nodes; communicates over SSH (Linux) or WinRM (Windows).

Declarative & Procedural — you describe what you want (install nginx, ensure service is running) in YAML-based Playbooks.

Idempotent — running the same playbook multiple times produces the same result without unintended side effects.


Core Components
ComponentDescription
InventoryList of hosts/groups Ansible manages
PlaybookYAML file defining automation tasks
TaskA single unit of work (install package, copy file)
ModuleBuilt-in function that does the actual work (yum, copy, service)
RoleReusable, structured collection of tasks
HandlerTask triggered only when notified (e.g. restart nginx after config change)
VaultEncrypts sensitive data (passwords, keys)
Control NodeMachine where Ansible runs
Managed NodeTarget machine being automated

Simple Playbook Example
- name: Install and start nginx
hosts: webservers
become: true # sudo
tasks:
- name: Install nginx
ansible.builtin.yum:
name: nginx
state: present
- name: Start and enable nginx
ansible.builtin.service:
name: nginx
state: started
enabled: true
- name: Copy config file
ansible.builtin.copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
notify: Restart nginx # triggers handler only if file changed
handlers:
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted

Common Use Cases
  • Configuration management — enforce consistent state across 100s of servers
  • Application deployment — deploy code, run migrations, restart services
  • Provisioning — spin up cloud VMs, containers, network devices
  • Orchestration — coordinate multi-tier deployments in order
  • Patching — rolling OS updates across a fleet
  • OpenShift/K8s automation — manage OCP clusters, operators, resources via k8s module

Ansible vs Other Tools
AnsiblePuppetChefTerraform
LanguageYAMLDSLRubyHCL
AgentAgentlessAgentAgentAgentless
StyleProcedural + DeclarativeDeclarativeProceduralDeclarative
Best forConfig mgmt + orchestrationConfig mgmtConfig mgmtInfrastructure provisioning

In the OpenShift/Red Hat World

  • Ansible Automation Platform (AAP) — enterprise version with UI, RBAC, scheduling
  • ansible-playbook for OCP — automate cluster installs, day-2 ops, operator config
  • OpenShift + Ansible — often used together; Ansible handles infra, OCP handles workloads
  • Operator SDK — some operators are built using Ansible roles

Leave a Reply