Explore the basic purpose of Ansible, and learn about some of the key features. Discover key strategies and languages used by Ansible, and the open-source community that maintains the project.
- [Instructor] Ansible, at is core, is a task execution engine. It exists to provide a method for operators, engineers, developers, hobbyists, or whomever, to easily define one or more actions to be performed on one or more computers. This capability represents a step beyond simply just logging into each computer in question, and manually typing out the command. These tasks can target the local system Ansible is running from, as well as other systems Ansible can reach over the network.
Arguably, the ability to manage remote systems is the most important aspect of Ansible. When combined with the ability to express the tasks to be performed in a simple to read text file, Ansible provides a reusable and repeatable system for managing a fleet of infrastructure. Ansible is designed to scale beyond a small handful of systems to manage. In order to efficiently address whole fleets of systems, Ansible must be able to work on multiple machines at the same time.
The default operation model allows Ansible to linearly execute a list of tasks on multiple machines at once. As the set of machines complete one task, they are given the next task to complete. This is the default, or linear strategy, and allows for data generated in an action on a particular machine to be used as input data for a later task on a different machine. There are however certain times when systems need to be worked on in smaller batches in a specific order.
This strategy is useful for rolling changes out in small batches into production, or minimizing the impact of an upgrade by disrupting only small portions of a service at any one time. This is the serial strategy. Instead of linearly walking through the task list, one or more hosts in batches are walked through the task list before looping back to the beginning for the next set of hosts. A third operation strategy was introduced with Ansible 2.0, in which machines complete tasks as fast as they individually can, without waiting for the rest of the hosts to complete a given task.
This is known as the free strategy, and is used mostly to reduce interruption of a specific machine or service, rather than the fleet as a whole. When using the strategy, it is not possible for one host to depend on task-generated data from a different host. The Ansible project manages code contribution and software releases. It is a very popular open source project. The Ansible company was created to fund development, which was later acquired by Red Hat.
It remains an open source project hosted on GitHub with a very large number of contributors to the core code, and to the modules. Ansible is written in Python, an easy to use, powerful programming language. Python's ubiquitous availability in operating systems and embedded devices along with its low barrier of entry make it a great choice for Ansible. Most modules are written in Python.
The way humans direct Ansible to accomplish tasks is with YAML formatted files. YAML neatly blends human readability with machine parsing. Perfectly suited as an operator to machine interaction language for Ansible.
- What is Ansible?
- Working with hosts and variables
- Controlling task and play behavior
- Coordinating complicated sets of actions
- Managing system configurations
- Reacting to configuration changes
- Repeating a task across a fleet
- Managing extensions in Ansible