All guides
Home Glossary Ansible
Term

Ansible

An open-source IT automation engine used for configuration management, application deployment, and task orchestration through an agentless architecture.

Ansible is an open-source IT automation engine used for configuration management, application deployment, and task orchestration through an agentless architecture. Using a declarative YAML-based language, it allows administrators to define the desired state of servers and applications in human-readable files. Because it relies on standard SSH or WinRM connections rather than custom background daemons, you can manage existing servers immediately without installing extra client software.

How it works

Automation runs from a central Linux or macOS machine called the Control Node, which connects to target systems known as Managed Nodes. The Control Node reads an inventory file listing your servers, then pushes small scripts called Ansible modules over SSH or WinRM. These modules execute specific tasks—such as installing packages, editing configuration files, or restarting services—and are automatically removed once execution finishes.

Tasks are organized into reusable YAML files called playbooks. A core principle of Ansible playbooks is idempotency: running the same playbook multiple times produces the exact same system state, making changes only when a server drifts from its defined configuration. In production environments, administrators scale execution across hundreds or thousands of servers simultaneously by adjusting parallel connection threads known as forks.

  • Configuration Management: Enforcing consistent OS settings, firewall rules, and software versions across fleets.
  • Application Deployment: Coordinating zero-downtime rolling updates across load balancers, web servers, and databases.
  • Cloud Provisioning: Creating and configuring virtual machines, networks, and storage in AWS, Azure, Google Cloud, or OpenStack.

Example

Before running full playbooks, operators typically test connectivity across all hosts listed in an inventory file with an ad-hoc command:

ansible all -i inventory.ini -m ping

To automate web server setup, you define a playbook like web.yml that installs Nginx and ensures the service is running:

---
- name: Configure web servers
  hosts: webservers
  become: true
  tasks:
    - name: Install Nginx
      ansible.builtin.apt:
        name: nginx
        state: present
        update_cache: true

    - name: Start and enable Nginx
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true

Executing ansible-playbook -i inventory.ini web.yml applies this configuration across every host in the webservers group.

What matters when choosing a server or hosting

When provisioning VPS instances, dedicated servers, or cloud machines for an Ansible workflow, verify a few foundational requirements:

  • Python availability: Most Linux modules require Python on the managed node. Choose minimal OS images that include Python 3, or bootstrap it via raw SSH commands.
  • SSH and privilege escalation: Ensure your hosting provider allows key-based SSH authentication and clean sudo access without interactive password prompts blocking automation.
  • Control Node resources: While managed nodes need zero extra RAM or CPU for agents, your Control Node requires sufficient memory and network bandwidth when running high fork counts.
  • Dynamic inventory support: If you use auto-scaling cloud instances, pick providers with maintained Ansible inventory plugins so new servers are discovered automatically.

Common mistakes

  • Overusing shell and command modules: Running raw bash commands via ansible.builtin.shell bypasses idempotency checks. Always prefer dedicated modules like apt, copy, or template.
  • Storing secrets in plain text: Committing API keys or database passwords directly into playbooks exposes credentials. Encrypt sensitive variables using ansible-vault.
  • Neglecting check mode: Running untested playbooks directly against production can cause outages. Test changes safely first using --check --diff flags.

FAQ

Does Ansible require an agent on target servers?

No. Ansible is agentless and communicates over standard SSH for Linux/Unix systems and WinRM for Windows hosts, leaving no persistent background processes on managed machines.

Can the Control Node run on Windows?

Not natively. While Ansible can manage Windows servers, the Control Node must run on a POSIX-compliant system such as Linux, macOS, or Windows Subsystem for Linux (WSL).

How does Ansible differ from Terraform?

Terraform focuses on provisioning and tracking cloud infrastructure lifecycle state, whereas Ansible excels at configuring operating systems, installing packages, and deploying applications inside those servers.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.