Chapter 4. Writing Better Cookbooks

"When you know better, you do better"

Maya Angelou

In this chapter, we will cover the following recipes:

  • Setting environment variables
  • Passing arguments to shell commands
  • Overriding attributes
  • Using search to find nodes
  • Using data bags
  • Using search to find data bag items
  • Using encrypted data bag items
  • Accessing data bag values from external scripts
  • Getting information about the environment
  • Writing cross-platform cookbooks
  • Making recipes idempotent by using conditional execution

Introduction

In this chapter, we'll see some more advanced topics in action. You'll see how to make your recipes more flexible by using search and data bags, and how to make sure your cookbooks run on different operating systems. You'll gain critical ...

Get Chef Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.