Red Hat Ansible: A 101 guide
You’ve probably heard a lot about Ansible recently. Are you curious to learn more about this rapidly growing DevOps tool? Here’s a guide to help you get started.
What is Red Hat Ansible?
Red Hat® Ansible® is an open source IT deployment, orchestration and configuration management tool. It allows IT teams to define how a client (or group of clients) should be configured, and then Ansible issues the commands to match that stated configuration. Using Ansible’s built-in modules, those clients we can control need not only be compute resources but other environments including storage controllers, network switches and on-premises and public clouds.
Why do we need Ansible?
If you think back to how we used to manage computing, it was often a very time-consuming and error-prone process. If we needed a new server to be built, we would ask the system administrators to manually build that instance. We might then require a certain software stack to be installed, along with a required configuration and user IDs and so forth. Once the server is active, we have the added complexity of keeping up with the developers requiring new software releases, configuration changes or issues around scaling. Ansible enables us to automate all these stages into efficient, repeatable tasks, allowing IT to align to flexible business requirements in this increasingly DevOps-driven world.
In the 2019 Gartner I&O Management Survey, 52% of respondents said they were investing and will continue to invest in infrastructure and operations automation. The same study highlighted that 42% of respondents said they planned to start investing within the next two years.
What can Ansible do?
Ansible gives us the ability to:
- Provision servers or virtual machines, both on premises and in the cloud
- Manage configuration of the clients, set up users, storage, permissions and the like
- Prevent configuration drift of clients by comparing desired state to current state
- Orchestrate new workloads, restarting application dependencies and so forth
- Automate application deployment and lifecycle management
Advantages of Ansible
There are a number of advantages in using Ansible ahead of other orchestration and configuration management tools:
Agentless: No agents are needed on the client systems you want to manage. Ansible communicates with the clients over the standard SSH port.
Simple: Ansible uses “playbooks” to define the required state of the client(s). Those playbooks are written in human-readable YAML format, so no programming skills are required.
Declarative: Ansible playbooks define a declarative state required for the client, and the key principle that enables this is idempotency. Idempotency is a concept borrowed from the world of mathematics meaning that an operation can be applied multiple times without changing the results beyond the initial application. For example, if you declare a client should have a software package installed at a certain version, Ansible will only install it if it isn’t already installed at that version.
Reusable: We have the ability to break tasks into a repeatable items called roles. These can then be called from multiple playbooks. For example, we might have a role that installs a database, one that configures users and one that adds additional storage. As we write new playbooks we just include the role we required, meaning we don’t have to rewrite that functionality multiple times.
Open: Ansible is a vibrant and reliable open source project and as such has a very active community, writing roles and modules for everyone to use. Galaxy Hub is once such repository where (for example) over 25,000 roles are available for anyone to download.
Using REST APIs, Ansible Tower also allows us to integrate with existing clouds, tools and processes. These include hybrid cloud endpoints such as IBM PowerVC, Amazon EC2, Google Cloud, Microsoft Azure and VMware vCenter. In addition to endpoints, Ansible Tower provides the ability to interact with source code management repositories including GitHub.
Ansible and IBM Systems
Ansible and Ansible Tower can be used to deploy and manage workloads across the IBM Systems portfolio. Using the core OpenStack modules, we can create playbooks to build virtual machines running AIX, IBM i or Linux across IBM Power Systems estates. Using the extensive IBM collections on Galaxy Hub, we can build instances in the IBM Cloud, manage AIX, IBM i, Linux and z/OS instances both on premises and in a public cloud (where appropriate). We can also manage IBM Spectrum Virtualize storage using the modules freely available in Galaxy Hub.
IT automation is vital in delivering the flexible DevOps-driven environment needed to support modern business requirements. Ansible is an extremely popular open source community-driven tool that provides a simple way of delivering IT automation. It allows you to manage a range of clients, including traditional virtual machines, storage controllers, network devices, cloud instances and more. With Ansible Tower, automation can be controlled and scheduled from a centralized dashboard.