Blog-Infrastructure_100x385

Chef Infra Best Practices: #7 Chef Workstation: One Click a Way from Everything

Seventh installment of the Shape-Up Your Infrastructure Webinar Series – “Chef Workstation: One Click away from Everything”.

Even with the advent of Infrastructure Automation processes almost a decade ago, developers today still find it challenging to configure secure infrastructure automatically, especially with many distributed multi-platform touchpoints that have varying configuration needs. Although, many forward strides have been made through the years, it has also led to increased complexity in these automation processes. Solutions like ChefDK tried to address these challenges aiming to make life easier for developers with their automated infrastructure management and compliance testing tools to ensure that infrastructure policies across IT fleets are consistent and security tested before they are shipped. But we have now come a long way from there.

In December 2020, we deprecated ChefDK and stopped shipping updates after replacing it with the more advanced and feature-rich successor: Chef Workstation. Chef Workstation has enhanced the features of certain tools within ChefDK (Foodcritic, Push jobs client), replaced certain tools by building in their functionality (Chef Sugar), and also made significant upgrades to Chef tools like Chef Infra, Habitat, InSpec, CLI, Test Kitchen and Cookstyle, making it easier than ever to automatically configure infrastructure policies, and continuously test these policies thoroughly in development.

Upgrades to Policyfiles, Test Kitchen, and Cookstyle

Policyfiles

Getting started with Policyfiles has become much more seamless now that generators have made creating and using Policyfiles simpler. One example of this can be seen when you run the command chef generate cookbook, which automatically generates the required Policyfile.rb. This was not possible in ChefDK. If you’re using Dokken, a kitchen.yml file with specific configuration for Dokken is generated automatically to make the start-up process easier and faster. This means, with Dokken drivers and Policyfiles, you can test your infrastructure code using Docker and Infra Client Containers literally in seconds. Further, Policyfiles now come with:

  1.  Human readable resources to get started without being a code-expert
  2. Over 480 built-in compliance resources and 150 infrastructure resources
  3. Flexibility in the form of custom resources that can be configured with Ruby

Test Kitchen

Test Kitchen has come a long way from version 2.11 that we had in ChefDK. The current version has a plethora of new functions to make testing fast and easy. Waste no more time in manually setting up test nodes when Test Kitchen can automatically do that for you. A few simple Test Kitchen commands on CLI automatically provision VMs or Cloud instances and start running InSpec tests to validate your code based on your recipes. Only the changes that pass InSpec testing are pushed to source control while failed runs are returned to Dev environment. Create, test, and commit secure and compliant code, with speed.

Cookstyle

Chef Cookstyle allows error-free and optimal code-writing by evaluating your code against hundreds of custom tailored Infra Cookbook rules and automatically correcting them. Built on Rubicop, it ensures you stay on track with respect to code style, and syntax and moves you toward newer, better patterns continually. Besides syntax errors, it also facilitates easy upgrades from lower to higher versions of Chef Infra clients by running compatibility scans and prompting upgrades to available versions.

In summary, Chef Workstation helps automate infrastructure configuration and security policies by allowing you to:

  • Improve the quality of code
  • Reduce time spent on writing and performing tests
  • Reduce deployment windows by quickly delivering on-demand DevTest environments

If you are still on ChefDK, move to Workstation now!

The “Shape-up Your Infrastructure Automation” webinars will continue through 2021. Check out the full list of On-Demand and upcoming webinars at the Chef Infra Best Practices Quickfire Webinars page.

You can also take a look at this eBook on Chef Infra Automation Best Practices for more information.

Tags:

Anugraha Benjamin

Anugraha Benjamin is a Senior Product Marketing Specialist at Chef.

Join Automate for Good hackathon and be eligible to win $60000 in prizes
chefconf-banner
image_334

FOLLOW @CHEF