Have a question?
Message sent Close

Ansible

Ansible is an open-source automation tool used for configuration management, application deployment, and task automation. It allows IT administrators and DevOps teams to manage infrastructure in a simple, agentless way using human-readable YAML files called playbooks. Ansible connects to servers over SSH (or WinRM for Windows) and executes tasks remotely, making it easy to orchestrate complex workflows across multiple systems. Its declarative approach ensures that systems reach and maintain a desired state, reducing manual errors and improving consistency. Due to its simplicity, wide platform support, and scalability, Ansible is widely adopted in DevOps pipelines and cloud infrastructure management.

 
 

Ansible is an open-source automation tool used for configuration management, application deployment, and task automation. It allows IT administrators and DevOps teams to manage infrastructure in a simple, agentless way using human-readable YAML files called playbooks. Ansible connects to servers over SSH (or WinRM for Windows) and executes tasks remotely, making it easy to orchestrate complex workflows across multiple systems. Its declarative approach ensures that systems reach and maintain a desired state, reducing manual errors and improving consistency. Due to its simplicity, wide platform support, and scalability, Ansible is widely adopted in DevOps pipelines and cloud infrastructure management.

 
 
  1. Architecture and Core Concepts
  • Agentless: Uses SSH (Linux) or WinRM (Windows), no agent installation required.
  • Idempotent: Ensures repeated runs produce the same result without unintended side effects.
  • Push-based model: Executes commands from a central control node to managed nodes.

 

  1. Playbooks
  • Written in YAML format.
  • Define desired system states and automation tasks.
  • Composed of:
    • Plays: Map tasks to hosts.
    • Tasks: Steps to be executed.
    • Modules: Units of work (e.g., installing packages, copying files).

 

  1. Inventory
  • Defines the list of managed hosts.
  • Can be static (INI/YAML files) or dynamic (cloud-based inventory scripts).
  • Supports grouping and variables per host/group.

 

  1. Modules
  • Reusable components that perform actions.
  • Core modules: apt, yum, copy, file, service, command, shell, etc.
  • Custom modules can be written in Python or any language.

 

  1. Roles
  • Reusable, structured collections of playbooks, variables, files, tasks, and handlers.
  • Encourage modularity and sharing.
  • Defined folder structure: tasks/, handlers/, defaults/, vars/, files/, etc.

 

  1. Variables and Facts
  • Variables: Allow dynamic configuration.
  • Facts: System information gathered from hosts (ansible_facts).
  • Support for default, host/group-specific, and external variable files.

 

  1. Conditionals and Loops
  • Execute tasks conditionally using when.
  • Iterate over items using with_items, loop, or advanced loop constructs.

 

  1. Handlers
  • Special tasks triggered by notify when something changes.
  • Used for operations like restarting a service after config changes.

 

  1. Templates
  • Use Jinja2 templating to dynamically generate configuration files or scripts.
  • Syntax: {{ variable_name }}.

 

  1. Ansible Galaxy
  • A hub for finding, sharing, and reusing Ansible roles and collections.
  • Command-line: ansible-galaxy install <role>.

 

  1. Vault
  • Encrypts sensitive data like passwords and keys in playbooks or variable files.
  • Command-line: ansible-vault encrypt, ansible-vault view, etc.

 

  1. Ansible Tower / AWX
  • Web UI and REST API for managing Ansible automation.
  • Features: role-based access control, job scheduling, audit logging, and inventory syncing.

 

How is Ansible different from other tools like Puppet or Chef?

Unlike Puppet or Chef, Ansible is agentless (no software required on target machines), uses simple YAML syntax, and connects over SSH. It’s known for its simplicity and ease of use.

 Ansible playbooks are written in YAML (Yet Another Markup Language).

The control node is the machine where Ansible is installed and from which commands and playbooks are executed.

Kerala
Thiruvalla, Pandalam, Adoor, Pathanamthitta, Kayamkulam, Kottayam, Marthandam, Neyyattinkkara, Nedumangad, Thiruvananthapuram City, Kilimanoor, Karikode, Kollam City, Karunagapally, Punalur, Anchal, Kuttikkanam, Elappara, Kalamassery, Kaloor, Angamali, Thrissur, Palakkad, Manjeri, Valanchery, Perinthalmanna, Calicut (Kozhikode), Perumbavoor, Vyttilla, Alappuzha, Harippad.

Tamil Nadu
Velachery, Anna Nagar, Thiruvattiyoor, Neyveli, Aranthangi, Pudukottai, Nagapattinam, Karaikal, Ariyalur, Mulumichampatti, Saravanampatti, Gandhipuram, Kumbakonam, Mayiladuthurai, Vaniyambadi, Vellore, Tirupattur (Vellore), Kancheepuram, Thiruvannamalai, Hosur, Hosur East.

Karnataka
Bangalore Electronic City, Mysore Kuvempunagar, Mysore City.

Andhra Pradesh
Panruti, Dilsukhnagar, Chittoor, West Godavari.

Maharashtra
Panvel, Dombivli, Dombivli East, Thane, Kalyan, Akurdi, Chinchwad, Nigdi, Karvenagar, Revet, Kothrud.

West Bengal
Kolkata, Durgapur.

Rajasthan
Sikar, Kota, Jhalawar.

Jharkhand
Ranchi.

Uttar Pradesh
Allahabad, Lucknow, Rambagh.