Ansible

From Canonica AI

Overview

Ansible is an open-source software provisioning, configuration management, and application-deployment tool. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. It includes its own declarative language to describe system configuration. Ansible was written by Michael DeHaan and acquired by Red Hat in 2015. Ansible is agentless, temporarily connecting remotely via SSH or Windows Remote Management (allowing remote PowerShell execution) to do its tasks.

Logo of Ansible, a stylized "A" in a circle.
Logo of Ansible, a stylized "A" in a circle.

Architecture

The design goals of Ansible include minimalism and consistency. The software uses no agents and no additional custom security infrastructure, and it also uses a very minimal amount of bootstrapping to install software. Its management nodes are typically Linux distributions such as Fedora, CentOS, and Red Hat Enterprise Linux, but it can also run on other Unix-like systems, including BSD variants and macOS. It manages nodes over SSH or PowerShell and requires Python (2.7 or later) to be installed on them.

Playbooks

Ansible's "playbooks" are a way to send commands to remote computers in a scripted way. Instead of using ad-hoc command-line arguments, users can configure complex environments by passing a script to the program. Playbooks are written in YAML and are easy to read, write, share and understand. Playbooks can include variables as well as tasks. Tasks are calls to Ansible modules, which are small pieces of code that perform a single, narrowly defined task.

Modules

Ansible uses "modules" to accomplish most of its Tasks. Modules can do things like install software, copy files, use templates and much more. Ansible includes hundreds of built-in modules, and you can also write your own.

Inventory

Ansible uses an "inventory" to track which hosts it manages. The inventory is configurable, and hosts can be grouped in various ways. Hosts can be managed individually, or in groups. The inventory file can list individual hosts, or entire groups of hosts.

Security

Ansible uses SSH keys with ssh-agent. This provides a robust and secure way of handling passwordless logins. For those users who prefer to use password-based authentication, Ansible can also use sshpass.

Use Cases

Ansible can be used for a wide variety of tasks, but it's most commonly used for configuration management, application deployment, and task automation. It can also be used for IT orchestration, where you have to run tasks in sequence and create a chain of events which must happen on several different servers or devices.

See Also