Ansible is an open-source IT automation system that’s great across multiple platforms and environments. At Zia, we use Ansible in installing, deploying customizations, and configuring Alfresco and Solr. Automating these tasks is a necessity because in a typical IT infrastructure you often have competing concerns:
– Development, test, and production systems (sometimes more)
– A mix of Linux and Windows platforms
– Custom development and third-party components
With all of these moving parts, it can be difficult to ensure that the right software and configuration is deployed correctly and consistently in the right environment. It is equally important that the deployed software and configuration are known for each environment.
Ansible solves this problem by adding a layer of code (in a sense) that deals with installing, deploying, and updating software. It uses a set of organized components to make this flexible to deal with the headache of multiple environments, platforms, and code versions. At a high level, the key components are:
The inventory is a catalog of host information, groups of hosts, and related configuration (such as usernames for each host). Using one inventory file for each environment allows you to manage multiple environments easily.
The playbook is the heart of Ansible, where each task is defined. The playbook is divided into one or more plays which themselves are groups of tasks to be performed on a specific host (or group of hosts).
Modules are the “commands” or “verbs” that Ansible performs in a task. The modules are generically named to support different platforms, but they each generally map to a single function on the target system, such as “shell,” “file,” or “copy.” Other modules deal with Ansible-specific functionality like “template,” which substitutes variable values into a template file and writes the finished file to the remote host.
Sometimes a set of tasks is repeatedly used in a playbook or in multiple playbooks. This set of tasks can be put in a subtasks file and imported into the main playbook.
A key part of Ansible is the ability to templatize configuration files (for example, the alfresco-global.properties file) and plug-in specific variable values that are relevant to the environment (Ansible inventory) and situation (what third-party modules are deployed).
The Ansible documentation provides much more detail. A great resource is: Getting Started with Ansible for Network Automation. Stay tuned for specific examples in more blog posts soon.