An overview of Scalr’s integrations with Ansible and Chef
At Scalr we believe configuration management tools, like Ansible and Chef, are a critical component of a successful cloud transformation. They are some of the most common things we talk about with customers and prospects. That’s why we have built deep integrations into both of these important tools. In this post we will explain how Scalr, in conjunction with Ansible and Chef, can achieve policy driven automation.
For those less familiar, Scalr is a Cloud Management Platform (CMP). Many enterprises today use CMPs at the center of the cloud transformation efforts so that at the core they have a policy engine that will safely allow applications teams to provision across multiple clouds while maintaining standards, tracking resources, and centrally orchestrating the cloud ecosystem. A CMP should track all the various lifecycle events a server will go through: events during provisioning, terminating, rebooting, attaching storage, etc. During the provisioning process a server might need to register with a DNS server or monitoring system, apply security patches to the OS, or update a ticketing system. Scalr is very good at tracking the lifecycle of the server and ensuring the correct integration or script is running at the correct time across the organization.
So at a high level, teams use Scalr to:
- Provision and track cloud resources throughout their lifecycle
- Enforce policy on those resources
- Centrally orchestrate integrations across the cloud ecosystem
- Track cost and budgets
Configuration management is a must have when companies talk about IT transformation and modernization. If you are going through a transformation, but still having to open a P1 because somehow you’re application magically had a setting updated, did you really transform anything? This is where configuration management comes into play. By using configuration management you can ensure that the application is always configured based on the template that the tool executes on it at a defined schedule. These tools keep the OS or application in-line with the baseline template, and they streamline and automate tasks associated with configuring Virtual Machines.
While both Scalr and configuration management tools have the ability to configure an OS or application, there are strengths that complement and enhance the two platforms working together including. Scalr is best for provisioning, tracking, and maintaining lifecycle management of cloud resources, enforcing policy, and cost management. Configuration management tools come in to configure the OS or application and avoid drift. Based on that, Scalr has built native integrations with Ansible Tower and Chef.
Scalr and Ansible
Ansible Tower is Ansible’s paid version that exposes a UI and an API. The integration between the two tools lets Scalr handle the provisioning and orchestration of the cloud resources and hands off to Ansible Tower to configure and maintain the OS and application.
In order to explain better how the integration works, we’ll need to review a few concepts and terms. In Ansible there are organizations, inventories, and groups. An organization is the parent to an inventory, an inventory is the parent to a group. These the ways to logically group servers to run a specified configuration on them. That configuration is called a Job Template in Ansible Tower which is the parent to a Playbook, a Playbook is written in YAML and is what executes the configuration on the OS.
When integrated with Ansible, Scalr will automatically bootstrap servers as they are provisioned into a specific Ansible Tower organization, inventory, and group based on the policy that is set. For example, if we log into a development environment in Scalr, then our servers will automatically join the development organization/inventory in Ansible Tower. If we log into the production environment in Scalr, then our servers will automatically join the production organization/inventory in Ansible Tower and run a completely different set of Job Templates from those in development. The key here is that the end user does not need to worry about placement as Scalr’s policy engine will take care of that for them.
Scalr also introduces the ability to run the Job Templates at different phases of the server lifecycle. As the server comes up we you may want to run a few different Job Templates to deploy the application, register with external systems, or a number of other tasks. During the life of the server, Ansible Tower will run the Job Templates periodically to ensure the OS and application maintains the proper configuration. As the server is being terminated, Scalr will call Ansible Tower to run the Job Templates that should be executed to ensure proper cleanup as well remove it from Ansible Tower.
The following two screenshots are example of what the integration with Ansible looks like, all the fields shown can be enforced by policy.
Bootstrap config assigned to a Farm Role:
The Job Template that will run during the HostInit phase:
Scalr and Chef
The concept of the Chef integration is exactly the same as the Ansible Tower integration, Scalr handles the provisioning and orchestration of the cloud resources and hands it off to Chef to configure and maintain the OS and application.
In Chef there are Organizations. Each Organization contains Roles, Cookbooks, and Recipes. A Role is the parent to one or more Cookbooks, a Cookbooks is the parent to one or more Recipes. A Recipe is what actually runs and configures the OS or application.
Scalr will automatically bootstrap servers as they are provisioned into a specific Chef Organization based on the policy set. As users create applications in Scalr they can predefine a list of Chef Roles and Recipes to be executed on the servers. Administrators can set a policy that all servers must get a specific Recipe, which app teams cannot remove, but app teams are also free to include their own Roles and Recipes on top of that. When the server is provisioning Scalr will hand off the configuration management and Chef will run the Roles/Recipes periodically to ensure the OS and application are in the correct state. As done in all integrations, Scalr will remove the server from Chef as it is being terminated to ensure proper cleanup.
The following is an example of what the integration with Chef looks like. All of these fields can be enforced by policy:
Putting it all together
When Scalr is integrated with Ansible or Chef, the tools work together to leverage each other’s strengths. Scalr enforces policy at the infrastructure and orchestration level giving the application teams autonomy, while Configuration Management tool configures the OS/application and ensures that is does not drift from that baseline. Automated provisioning, orchestration and configuration is at the core of cloud transformation and the combination of these tools will help you achieve that faster.