Internative Logo

What Is Ansible? Agentless Automation for Servers and Networks

What Is Ansible? Agentless Automation for Servers and Networks

Setting up one server by hand is fine. Setting up twenty the same way, keeping them identical after a year of patches and hotfixes, and rebuilding one quickly after a failure is not. Manual changes drift, and nobody remembers exactly which packages and settings production depends on. Ansible turns that knowledge into readable files that a machine can apply again and again, with the same result each time.

This article explains what Ansible is, how it works without agents, where it fits next to Terraform and Kubernetes, and when another tool is the better choice.

What is Ansible?

Ansible is an open-source IT automation tool. It configures servers, installs and updates software, deploys applications and orchestrates multi-step operations across many machines. You describe the desired state in YAML files called playbooks, and Ansible connects to the target machines, usually over SSH, and makes them match.

Michael DeHaan, who had earlier written the Cobbler provisioning server at Red Hat, started Ansible in February 2012. Ansible 1.0 followed on 1 February 2013. The company built around it, Ansible, Inc., was acquired by Red Hat, with the deal announced on 16 October 2015. Red Hat now sells Red Hat Ansible Automation Platform, while the core project stays open source under the GPLv3 licence and is written in Python.

Since 2020 the project has been split into two parts: ansible-core, the engine and a small set of built-in modules, and the larger Ansible community package, which bundles collections of modules for clouds, operating systems and network devices.

How Ansible works

Control node and managed nodes. You run Ansible from a control node, which can be a laptop, a CI runner or a dedicated server. The machines it manages are managed nodes. They need no Ansible software installed, only SSH access and Python; Windows hosts are reached over WinRM or SSH, and network devices through their own CLI or API connections.

Inventory. The inventory lists the managed nodes and groups them, for example web, db or production. It can be a static file or generated dynamically from a cloud provider, so new instances are picked up automatically.

Modules and tasks. Each task calls a module: install a package, write a file from a template, start a service, create a user. Ansible copies the module to the target, runs it, collects the JSON result and removes it.

Playbooks and roles. A playbook maps groups of hosts to ordered lists of tasks. Roles package related tasks, templates, variables and handlers, for example everything needed to set up Nginx, so they can be reused across projects and shared through Ansible Galaxy.

Idempotency. Well-written tasks describe a state, not an action. Running the same playbook twice changes nothing the second time, because the package is already installed and the file already matches. That is what makes playbooks safe to run regularly to catch drift.

Key features

  • Agentless: nothing to install or keep running on managed machines.
  • Readable YAML that operations and development teams can both review in a pull request.
  • Thousands of modules in collections for Linux, Windows, network equipment and the major cloud providers.
  • Jinja2 templating for configuration files that differ per environment.
  • Ansible Vault for encrypting passwords and keys inside the repository.
  • Check and diff modes to preview what a run would change before applying it.
  • AWX and Automation Platform for a web interface, scheduling, access control and run history.

Where Ansible is used

  • Server configuration and hardening: users, packages, firewall rules and security baselines applied the same way everywhere.
  • Application deployment to virtual machines and bare-metal servers, including rolling updates one batch of hosts at a time.
  • Patching and routine operations: updates, certificate renewals, log rotation and backups across a fleet.
  • Network automation: switches, routers and firewalls from many vendors.
  • Hybrid and on-premise environments, where the same playbooks configure cloud instances and machines in a customer's data centre.
  • Cluster setup: installing container runtimes or bootstrapping Kubernetes nodes, which projects such as Kubespray do with Ansible.

When to choose Ansible, and when not to

Choose Ansible when:

  • You manage long-lived servers or virtual machines that need consistent configuration.
  • You want automation without installing and maintaining agents on every host.
  • Several teams need to read and review infrastructure changes as code.
  • The environment mixes clouds, on-premise machines and network devices.

Look elsewhere when:

  • You mainly need to create cloud resources, such as networks, databases and load balancers, and track them over time. Terraform or Pulumi keep a state of what exists and plan changes against it.
  • The workload is fully containerised. Images built with Docker and orchestrated by Kubernetes replace most server configuration.
  • You manage very large fleets that must converge continuously on their own. Agent-based tools such as Puppet or Chef are built for that model.
  • The logic is complex enough that YAML with conditionals and loops becomes harder to read than code.

Ansible's weak spots are well known: runs slow down with many hosts because each connection is a separate SSH session, it keeps no state, so removing a task does not remove what it created, and large playbook trees need discipline to stay readable.

Ansible and its alternatives

ToolApproachAgentBest fit
AnsiblePush, YAML playbooksNoConfiguration, deployment and operations tasks
Terraform / OpenTofuDeclarative, with stateNoProvisioning cloud infrastructure
PuppetPull, declarative DSLYesLarge fleets kept in a desired state
ChefPull, Ruby-based recipesYesTeams comfortable with code-heavy configuration
SaltEvent-driven, push or pullUsuallyFast remote execution across many machines

The most common comparison is Ansible vs Terraform, and the answer is usually both. Terraform creates the infrastructure, such as virtual machines, networks and managed databases, and Ansible configures what runs on it. Pipelines in GitHub Actions, GitLab CI/CD or Jenkins often run them one after the other. We cover the wider delivery picture in DevOps and CI/CD: continuous improvement in software development.

How we use Ansible at Internative

We use Ansible to automate infrastructure configuration and operational workflows reliably. Its agentless design and readable playbooks let us manage environments efficiently and keep configuration drift under control.

If you want servers that can be rebuilt from code, or your infrastructure spans cloud and on-premise machines, our DevOps services and hybrid infrastructure setup teams can help you decide where Ansible belongs.

Frequently asked questions

Is Ansible better than Terraform?

They solve different problems. Terraform provisions infrastructure and keeps a state file of what it created, so it can plan changes and remove resources. Ansible configures machines and runs operational tasks. Most teams use Terraform to create resources and Ansible to configure them.

What is the difference between Ansible and Kubernetes?

Kubernetes runs and manages containers across a cluster and keeps them in the desired state continuously. Ansible is an automation tool that runs tasks when you execute it. Ansible can install a Kubernetes cluster or apply manifests to it, but it does not schedule or heal containers.

Is Ansible still relevant?

Yes. Containers and managed services have reduced how much server configuration some teams do, but virtual machines, bare-metal servers, network devices and on-premise systems still need configuring, patching and hardening, and Ansible remains one of the most widely used tools for that.

What is the best alternative to Ansible?

It depends on the job. For provisioning cloud resources, Terraform, OpenTofu or Pulumi. For keeping large fleets continuously in a desired state, Puppet or Chef. For container workloads, Kubernetes with Helm or similar tools largely replaces server configuration.

How is an Ansible project structured?

A typical project has an inventory of hosts and groups, playbooks that map groups to tasks, roles that package reusable tasks, templates and variables, and group or host variable files. Collections from Ansible Galaxy add modules, and Ansible Vault keeps secrets encrypted inside the same repository.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.